目录

min-height

描述 (Description)

min-height属性用于设置元素高度的下限。

可能的值 (Possible Values)

  • length - 任何长度单位。 该元素的高度值永远不会低于此距离。

  • percentage - 将元素的高度限制为至少包含块高度的百分比。

适用于 (Applies to)

除了未替换的内联元素和表元素之外的所有HTML元素。

DOM语法 (DOM Syntax)

object.style.minHeight = "50px"

例子 (Example)

这是一个例子 -

<html>
   <head>
   </head>
   <body>
      <p style = "width:400px; min-height:200px; border:1px solid red; padding:5px; margin:10px;">
         This paragraph is 400px wide and min height is 200px
         This paragraph is 400px wide and min height is 200px
         This paragraph is 400px wide and min height is 200px
         This paragraph is 400px wide and min height is 200px
      </p>
      <img alt = "logo" src = "/css/images/logo.png" width = "95" height = "84" />
   </body>
</html> 

这将产生以下结果 -

新页面打开
↑回到顶部↑
WIKI教程 @2018