Tips for using DIV container fixed height in IE6 and IE7

Tips for using DIV container fixed height in IE6 and IE7
There are many differences between IE6 and IE7 in their interpretation of CSS. Today we will talk about one of them: height.
example:
Copy code
The code is as follows:
<div style="height:50px">


Under IE6: If the content height in the DIV does not exceed 50px, the height of the DIV is 50px. If it exceeds the set value, the height will expand with the content, which is usually called adaptive height.
Under IE7: If the height of the content in the DIV does not exceed 50px, the height of the DIV is 50px. If it exceeds the set value, the height of the DIV will still be fixed at 50px, and the excess content will exceed the DIV and overflow. If there is other content under the DIV, it will overlap with the overflowing content.

This is obviously a very important point, if not handled it will cause page disorder. There are usually two ways to solve this problem:

1. Focus on height: fix the height of DIV to 50px, hide the extra content, and write the CSS for both browsers as follows:
Copy code
The code is as follows:
<div style="height:50px;overflow:hidden">
overflow:hidden is very important, compatibility depends on it

2. Content-oriented: Set the minimum DIV height to 50px. When there is too much content, the DIV height will adapt to the content. At this time, CSS HACK is needed to do some compatibility processing:
<div style="min-height:50px;_height:50px;">, min-height:50px minimum height, this IE7 and FF can recognize, _height:50px is underlined for the purpose of only allowing IE6 to recognize it.

<<:  Use CSS to achieve three-column adaptive layout (fixed width on both sides, adaptive in the middle)

>>:  The latest Linux installation process of tomcat8

Recommend

A brief talk about Mysql index and redis jump table

summary During the interview, when discussing abo...

Example code for using Nginx to implement 301 redirect to https root domain name

Based on SEO and security considerations, a 301 r...

How to use limit_req_zone in Nginx to limit the access to the same IP

Nginx can use the limit_req_zone directive of the...

CSS code to achieve background gradient and automatic full screen

CSS issues about background gradient and automati...

Tutorial on installing MySQL under Linux

Table of contents 1. Delete the old version 2. Ch...

Vue+Bootstrap realizes a simple student management system

I used vue and bootstrap to make a relatively sim...

Upgrading Windows Server 2008R2 File Server to Windows Server 2016

The user organization has two Windows Server 2008...

Realize super cool water light effect based on canvas

This article example shares with you the specific...

Solve the problem of setting Chinese language pack for Docker container

If you use docker search centos in Docker Use doc...

Linux hardware configuration command example

Hardware View Commands system # uname -a # View k...

MySQL 5.6 installation steps with pictures and text

MySQL is an open source small relational database...

Introduction to Semantic HTML Tags

In the past few years, DIV+CSS was very popular in...

Install and configure ssh in CentOS7

1. Install openssh-server yum install -y openssl ...