gpt4 book ai didi

css - 使 CSS 在不同尺寸下更流畅

转载 作者:行者123 更新时间:2023-11-28 11:57:49 25 4
gpt4 key购买 nike

我在 http://jsfiddle.net/Dx5d8/ 重现了这个问题

我有一个 100% 宽和 200 像素高的背景 div,最小宽度为 600 像素。我在里面有五个 float 的 div。

是否可以随着布局宽度的变化,扩展背景 div 的宽度以覆盖 float 的 div?

如有任何帮助,我们将不胜感激!

#stripe {
height: 200px;
width: 100%;
min-width:600px;
text-align: center;
position: relative;
background-image: url(http://signaturewebdesign.net/egro14/14_images/brown_stripe_bg.png);
background-repeat: repeat;
}
.holder {
float: left;
height: 200px;
width: 125px;
display: inline-block;
padding-right: 13px;
padding-left: 12px;
margin: auto;
}

最佳答案

如果您希望当元素占据多于一行时改变高度,您可以添加overflow:hidden并将height设置为auto 为你的 #stripe 风格:

#stripe {
height: auto;
width: 100%;
min-width:600px;
text-align: center;
position: relative;
background-image: url(http://signaturewebdesign.net/egro14/14_images/brown_stripe_bg.png);
background-repeat: repeat;
overflow:hidden;
}

jsfiddle

关于css - 使 CSS 在不同尺寸下更流畅,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20025655/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com