Heim  >  Artikel  >  Web-Frontend  >  Legen Sie die maximale Höhe einer Box mithilfe von CSS fest

Legen Sie die maximale Höhe einer Box mithilfe von CSS fest

WBOY
WBOYnach vorne
2023-09-03 21:05:031363Durchsuche

使用 CSS 设置框的最大高度

Das max-height-Attribut wird verwendet, um die maximale Höhe einer Box festzulegen. Der Wert des Attributs „max-height“ kann eine Zahl, eine Länge oder ein Prozentsatz sein.

Beispiel

<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>

Das obige ist der detaillierte Inhalt vonLegen Sie die maximale Höhe einer Box mithilfe von CSS fest. Für weitere Informationen folgen Sie bitte anderen verwandten Artikeln auf der PHP chinesischen Website!

Stellungnahme:
Dieser Artikel ist reproduziert unter:tutorialspoint.com. Bei Verstößen wenden Sie sich bitte an admin@php.cn löschen