Home >Web Front-end >HTML Tutorial >How to achieve minimum height in div css. _html/css_WEB-ITnose

How to achieve minimum height in div css. _html/css_WEB-ITnose

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-24 12:29:081356browse

Requirements: Under different browsers, when there are many words required, the box will automatically extend. If there are few words, it will be 200px. If there are no words, it will still be this height. This example mainly uses (!important)

CSS code:

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

 

HTML Code:

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