Home  >  Article  >  Web Front-end  >  div+css如何实现最小高度。_html/css_WEB-ITnose

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

WBOY
WBOYOriginal
2016-06-24 12:29:081265browse

要求:在不同的浏览器下,要求字多的时候,框会自动延伸,字少的情况下是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>

 

 

 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn