The div inside is how to open the outside div to make it highly adaptable

Source: Internet
Author: User

Reference URL: http://www.jb51.net/css/140685.html

With Microsoft's new operating system listed, IE6 now use fewer people, but the XP system seems to be too classic, there are still a considerable number of users in use, and most of this group of people do not have the habit of upgrading the browser alone, so IE6 is still the most used browser version. According to the traffic statistics of this station, the visit proportion from IE6 is 72.6%. Show the above view, although the highest time, IE6 accounted for more than 90%.

At the same, div+css as the layout of the page is the trend. Its merits are not here to be wordy. Recently, however, many friends have mentioned compatibility issues about container height adaptation. Here's a quick answer.

1. Sometimes, we want the container to have a fixed height, but when the content is many, but also want to be highly adaptive, that is, the container in the longitudinal can be open, and if there is a background, can also be adaptive. Under normal circumstances, the use of min-height can be solved. But the majority of Internet users of the preferred browser IE6 does not support min-height. Ie7,opera, Firefox is no problem. Therefore, the following wording can be used to resolve compatibility:


The code is as follows:
Height:auto!important; height:200px; min-height:200px;


2. Many friends reflect the above method, in some cases still can not solve the container can not open the adaptive problem. That must be the case of container nesting, and the sub-containers are floating. For example
<div class= "Fuqin" ><ul><li> content 1</li><li> content 1</li></ul></div>
Where class Fuqin div has floating Li, when Li is more, even the div set is the smallest height, also cannot be open.

The reason is that Li, as a sub-container, is floating. In this case, even if Li's content exceeds the height of the Div, the div cannot be stretched.

Here's how to fix it:
After the floating container, add a div before the parent container ends

The code is as follows:
<Divclass= "Fuqin"><ul><Li>Content 1</Li><Li>Content 1</Li&gt;</ul><Divclass= "Clearfloat"></Div></Div>. clearfloat{clear:both;height:0;font-size:1px;line-height:0px;}

The div inside is how to open the outside div to make it highly adaptable

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.