Heim  >  Artikel  >  Web-Frontend  >  div+css如何实现最小高度。_html/css_WEB-ITnose

div+css如何实现最小高度。_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:29:081266Durchsuche

要求:在不同的浏览器下,要求字多的时候,框会自动延伸,字少的情况下是200px,字没有的情况下还是这个高度。此例子主要用了(!important)

 

CSS代码:

 

*{padding:0; margin:0}body{ font-size:30px;padding:100px}.box{width:300px; height:auto !important; min-height:200px;border:5px solid #000000}

  

HTML代码:

 

View Code

 1 <div class="box"> 2 smart工作室<br /> 3 smart工作室<br /> 4 smart工作室<br /> 5 smart工作室<br /> 6 smart工作室<br /> 7 smart工作室<br /> 8 smart工作室<br /> 9 smart工作室<br />10 smart工作室<br />11 smart工作室<br />12 smart工作室<br />13 smart工作室<br />14 smart工作室<br />15 </div>

 

 

 

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn