Firefox div highly adaptive

Source: Internet
Author: User

1. if div wants a minimum height, the minheight attribute of css should be used, but IE does not support it. Considering that most users use IE, this attribute is generally discarded. In IE, the height can basically be used as minheight, because if the content exceeds the height, IE will adapt to its height. However, once the height is set, FIrefox will not adapt to the height of the div. Therefore, only two attributes are not needed, so you can write <div> Jimbor Studio </div> cleanly.

2. Firefox is not so adaptive to height even if it is not set to a fixed height. If you need to nest a layer that requires float, it will fail again. In fact, the simplest method is to add a clear: both div at the bottom of the div. For example:

Copy codeThe Code is as follows:
<Div>
<Div style = "float: left;"> Jmedia Design </div>
<Div style = "float: right;"> www.jmedia.cn </div>
<Div style = "clear: both;"> </div>
</Div>


3. You can also see a js solution.
Copy codeThe Code is as follows:
<Script type = "text/javascript">
<! --
Document. getElementById ("box"). style. height = document. getElementById ("right"). scrollHeight + 20 + "px"
-->
</Script>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.