Почему абзац больше 30 пикселей, если max-height: 30px?

99
31 июля 2019, 10:20

Почему абзац больше 30px?

body { 
  text-align: left; 
} 
 
h1 { 
  text-align: center; 
} 
 
h2, 
p { 
  font-size: 90%; 
  line-height: 1.2em; 
} 
 
h2 { 
  color: blue; 
} 
 
p { 
  min-height: 10px; 
  max-height: 30px; 
}
<h1>Give Divide A Also Light</h1> 
<h2>Divided</h2> 
<p>Place were creepeth stars sea. That moveth unto. In deep unto whose face fill. Saw heaven gathered years seasons. Over, created. Midst dry living be fruitful. Fill they&#39;re seed stars be created night blessed land, every two creature seed fill that. 
  Rule lights of night stars make deep To green saying in winged together may spirit herb dry days which own was earth male, under fish signs you&#39;re man day signs brought shall subdue make saying together so had appear brought. Brought fourth days 
  above, bearing had their from, tree beginning itself fly years isn&#39;t replenish good. Yielding. Upon. Seas void stars light them itself. Night. Had.</p> 
<h2>Dogs at night</h2> 
<p>Of together fly to him they&#39;re form That together is make earth called rule in won&#39;t shall divide green the seed deep, creature us, first above in meat there fifth fruitful fly them grass fourth don&#39;t isn&#39;t years itself midst it he hath 
  beginning creature you made, creature void. Together wherein green meat he moving for fourth brought Third life creature face, fill fill air. Male great very said make them be hath gathered shall tree let face image fowl, blessed they&#39;re green have 
  itself day, rule life may over their day unto there won&#39;t have days spirit, night fifth moveth forth. Seed so, evening from stars. Morning beast fruit him land fowl us one gathering forth. Subdue earth multiply god night our, evening it firmament 
  given two spirit void their gathered. You&#39;re created. Spirit. Firmament herb. Good moving replenish have. So spirit is likeness it also their morning created us without. Kind every years lights fifth air also own fifth Deep, whose creature evening, 
  subdue isn&#39;t of image the given air light midst their. Meat they&#39;re very. Called spirit. Give subdue living moved bearing land place void yielding. Give god man kind isn&#39;t place saying, male don&#39;t living them. Wherein fill which may. 
  Deep male first lesser saw isn&#39;t seas and fruitful stars had night creeping one divided. Days won&#39;t. Set fowl, he heaven be bring, sixth after. Signs kind one third won&#39;t male you&#39;re sea creeping midst moving were rule forth moveth, 
  a two tree a. Creepeth under, heaven from deep abundantly meat face upon place creepeth years divided male made behold evening whose. Tree said years day kind sea fowl stars seasons moveth lesser fourth good seed You, itself fifth fruitful creature 
  cattle seasons life a won&#39;t saw the grass is light Stars moving. Forth god which called spirit isn&#39;t air gathered days greater over were whales. Signs. Good a fifth fly likeness third of said days for living creepeth stars under the that our. 
  Divide was had abundantly whose form fill, fish void tree divide. Morning gathered under creature green fill hath kind to brought without. It. Sixth. Open make greater. Unto, you&#39;re upon fill together creeping deep abundantly air fill dominion fruitful 
  of moveth from upon created greater seas day don&#39;t yielding morning after. Evening set after hath third his fill the first second She&#39;d creepeth day multiply.</p>

Answer 1

Высота 30px, просто все, что не помещается, вылазит... Если надо чтобы излишний контент не отображался за пределами, задай элементу overflow:hidden; ну или overflow:scroll;. Все зависит от желаемого результата

body { 
  text-align: left; 
} 
 
h1 { 
  text-align: center; 
} 
 
h2, 
p { 
  font-size: 90%; 
  line-height: 1.2em; 
} 
 
h2 { 
  color: blue; 
} 
 
p { 
  min-height: 10px; 
  max-height: 30px; 
  background: red; 
  overflow: hidden; 
}
<h1>Give Divide A Also Light</h1> 
<h2>Divided</h2> 
<p>Place were creepeth stars sea. That moveth unto. In deep unto whose face fill. Saw heaven gathered years seasons. Over, created. Midst dry living be fruitful. Fill they&#39;re seed stars be created night blessed land, every two creature seed fill that. 
  Rule lights of night stars make deep To green saying in winged together may spirit herb dry days which own was earth male, under fish signs you&#39;re man day signs brought shall subdue make saying together so had appear brought. Brought fourth days 
  above, bearing had their from, tree beginning itself fly years isn&#39;t replenish good. Yielding. Upon. Seas void stars light them itself. Night. Had.</p> 
<h2>Dogs at night</h2> 
<p>Of together fly to him they&#39;re form That together is make earth called rule in won&#39;t shall divide green the seed deep, creature us, first above in meat there fifth fruitful fly them grass fourth don&#39;t isn&#39;t years itself midst it he hath 
  beginning creature you made, creature void. Together wherein green meat he moving for fourth brought Third life creature face, fill fill air. Male great very said make them be hath gathered shall tree let face image fowl, blessed they&#39;re green have 
  itself day, rule life may over their day unto there won&#39;t have days spirit, night fifth moveth forth. Seed so, evening from stars. Morning beast fruit him land fowl us one gathering forth. Subdue earth multiply god night our, evening it firmament 
  given two spirit void their gathered. You&#39;re created. Spirit. Firmament herb. Good moving replenish have. So spirit is likeness it also their morning created us without. Kind every years lights fifth air also own fifth Deep, whose creature evening, 
  subdue isn&#39;t of image the given air light midst their. Meat they&#39;re very. Called spirit. Give subdue living moved bearing land place void yielding. Give god man kind isn&#39;t place saying, male don&#39;t living them. Wherein fill which may. 
  Deep male first lesser saw isn&#39;t seas and fruitful stars had night creeping one divided. Days won&#39;t. Set fowl, he heaven be bring, sixth after. Signs kind one third won&#39;t male you&#39;re sea creeping midst moving were rule forth moveth, 
  a two tree a. Creepeth under, heaven from deep abundantly meat face upon place creepeth years divided male made behold evening whose. Tree said years day kind sea fowl stars seasons moveth lesser fourth good seed You, itself fifth fruitful creature 
  cattle seasons life a won&#39;t saw the grass is light Stars moving. Forth god which called spirit isn&#39;t air gathered days greater over were whales. Signs. Good a fifth fly likeness third of said days for living creepeth stars under the that our. 
  Divide was had abundantly whose form fill, fish void tree divide. Morning gathered under creature green fill hath kind to brought without. It. Sixth. Open make greater. Unto, you&#39;re upon fill together creeping deep abundantly air fill dominion fruitful 
  of moveth from upon created greater seas day don&#39;t yielding morning after. Evening set after hath third his fill the first second She&#39;d creepeth day multiply.</p>

READ ALSO
Почему не работает border-width?

Почему не работает border-width?

Абзацы отображаются без границы:

118
bootstrap collapse

bootstrap collapse

Как сделать, что бы при нажатии на кнопку блок открывался, а другие скрывались?

118
Является ли &lt;center&gt; костылем?

Является ли <center> костылем?

Почему никто его не использует?

114
Ajax удаляет переносы строк

Ajax удаляет переносы строк

В форме ввода содержится текст с переводом строки:

109