CSS min-width属性
描述
min-width属性用于设置元素宽度的下边界。
可能的值
- length − 任何长度单位。元素的宽度不能小于这个距离。
-
percentage − 限制元素的宽度至少为容器块宽度的这个百分比。
适用于
除了非替代的内联元素和表格元素,所有HTML元素。
DOM语法
object.style.minWidth = "50px"
示例
这是一个示例 –
<html>
<head>
</head>
<body>
<p style = "min-width:400px; height:100px; border:1px solid red; padding:5px; margin:10px;">
This paragraph is 100px high and min width is 400px
This paragraph is 100px high and min width is 400px
This paragraph is 100px high and min width is 400px
This paragraph is 100px high and min width is 400px
This paragraph is 100px high and min width is 400px
</p>
<img alt = "logo" src = "/css/images/logo.png" width = "95" height = "84" />
</body>
</html>
将产生以下结果−