Divs的响应设计
我有以下HTML代码(.CONTAINER内的DIV数量可能会有所不同)。
我想给它们一个最小的宽度,但否则它们应该填充屏幕的整个宽度。当屏幕的宽度太小(对于响应式设计)时,Divs应该简单地进入新线路。
看起来很简单,但是我一直在用梁,弯曲甚至漂浮的头敲打头,但似乎没有什么可用。没有人可以在不使用媒体查询的情况下提供帮助吗?
<div class="container">
<div>pippo</div>
<div>pluto</div>
<div>paperino</div>
<div>topolino</div>
</div>
I have the following HTML code (the number of divs within the .container can vary).
I want to give these a min width, but otherwise these should fill up the whole width of the screen. When the width of the screen is too small (for responsive designs) the divs should simply go on a new line.
It seems simple, but I've been banging my head with gird, flex and even float, but nothing seems to work. Anybody can help without using media queries?
<div class="container">
<div>pippo</div>
<div>pluto</div>
<div>paperino</div>
<div>topolino</div>
</div>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用
flex-wrap:wrap;
当没有DIV空间时,DIV包裹到下一行。我也使用
Jusify-content:space-betew;
填充屏幕的整个宽度with
flex-wrap: wrap;
when there was no space for div, div wrap to the next line.also i use
justify-content: space-between;
to fill up the whole width of the screen