扫码关注官方订阅号
我在移动端做一个左右排版用了flex,图片就是自适应的,但是出来的效果这样是怎么回事? .contentlist{ width: 98%; margin:0.5rem auto; display: flex; display: -webkit-flex; justify-content:space-between; -webkit-justify-content:space-between; }
出来的效果是这样
实际要这样
要怎么破
个人理解虽然 space-between;是两端对齐但是如果图片太小撑不起p,是不是就会是上面的那样。
._left{ width: 100%; } ._right{ width: 100%; } img{ width: 100%; } 试一下。
加上 align-items: stretch;
._left{ width: 50%; height: 100%; } ._right{ width: 50%; height: 100%; } img{ width: 100%; } 试试。。。
justify-content:space-between;align-items:center;
display:flex;display:-webkit-flex;flex-wrap:wrap;justify-content:flex-start;
这堆东西确实是好用,然并...不兼容
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
个人理解虽然 space-between;是两端对齐但是如果图片太小撑不起p,是不是就会是上面的那样。
加上 align-items: stretch;
justify-content:space-between;align-items:center;
display:flex;display:-webkit-flex;flex-wrap:wrap;justify-content:flex-start;
这堆东西确实是好用,然并...不兼容