使用 CSS 设置框的最大高度

cssweb developmentfront end technology更新于 2025/8/22 23:40:17

max-height 属性用于设置框的最大高度。max-height 属性的值可以是数字、长度或百分比。

示例

<html>
   <head>
   </head>
   <body>
      <p style = "width:400px; max-height:10px; border:2px solid green; padding:10px; margin:15px;">
         This paragraph is 400px wide and max height is 10px
         This paragraph is 400px wide and max height is 10px
         This paragraph is 400px wide and max height is 10px
         This paragraph is 400px wide and max height is 10px
      </p>
      <br>
      <br>
      <br>
      <img alt = "logo" src = "/css/images/logo.png" width = "210" height = "100" />
   </body>
</html>

相关文章


有用资源