javascript - css样式根据动态内容设置div else的最小宽度

标签 javascript jquery css html

如何设置 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/

相关文章:

javascript - 在 box-shadow 上使用边框半径

php - 将 base64 图像从 php 查询传递到 html5 canvas

javascript - head 中的重定位是否会停止页面其余部分的加载?

javascript - SyntaxError : unterminated string literal <script>. ..</script> 标记在字符串变量中不起作用

javascript - 如何使用 jquery 将更改保存到文本区域

javascript - 使用 2 个按钮在 2 个 div 之间切换

css - 如何将 HTML5 范围输入设置为在 slider 前后具有不同的颜色?

javascript - 使用正则表达式解析 URL 查询参数

jquery - 获取正确的图像大小

html - 当 P 是相对的儿子时,将绝对父 P 拉伸(stretch)到其子宽度