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

How to enable Swoole Loader extension on Linux system virtual host

Special note: Only the Swoole extension is instal...

Implementation of CSS child element selection parent element

Usually a CSS selector selects from top to bottom...

An example of installing MySQL on Linux and configuring external network access

Configuration steps 1. Check whether DNS is confi...

Solve the problem of Docker starting Elasticsearch7.x and reporting an error

Using the Docker run command docker run -d -p 920...

Detailed installation and use tutorial of mysql 8.0.15 under windows

This article shares with you the detailed install...

A brief discussion on the CSS overflow mechanism

Why do you need to learn CSS overflow mechanism i...

Front-end JavaScript Promise

Table of contents 1. What is Promise 2. Basic usa...

MySQL 5.7 cluster configuration steps

Table of contents 1. Modify the my.cnf file of se...

Tips for using DIV container fixed height in IE6 and IE7

There are many differences between IE6 and IE7 in ...

Summary of several submission methods of HTML forms

The most common, most commonly used and most gener...

How to set the style of ordered and unordered list items in CSS

In an unordered list ul>li, the symbol of an u...

Vue recursively implements three-level menu

This article example shares the specific code of ...

Detailed explanation of the difference between uniapp and vue

Table of contents 1. Simple page example 2.uni-ap...