如何设置 div 的最小宽度。我的问题是我在 div 中动态加载内容,有时它很大,有时它很小。
如果它很小,那么后面的 div 就会变得不可见,所以我想避免这种情况。并将 div 设置为等于父 div 高度的最小值,或者如果内容大于 auto ??
CSS::
#middle_overlay
{
position:absolute;
/*border:2px solid #008080;
background-color:#CCCCCC;*/
background-image:url(../images/bg2.jpg);
background-repeat:no-repeat;
background-size:100% 100%;
height:auto;
width:100%;
display:none;
}
最佳答案
min-width:xxx;
适合你吗?
The min-width CSS property is used to set the minimum width of a given element. It prevents the used value of the width property from becoming smaller than the value specified for min-width.
参见 here了解更多信息
关于javascript - css样式根据动态内容设置div else的最小宽度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20120237/