The role of Zoom:1 and Z-index in CSS

Source: Internet
Author: User

First, the role of zoom:1 in CSS
In doing IE6, IE7, IE8 browser compatibility, often encounter some problems, you can use Zoom:1 to solve, has the following role:
1, trigger the haslayout of IE browser
2, to solve the floating under IE, margin overlap and some other issues.

Second, Z-index:auto|number;

Auto follows the positioning of its parent object

Number has no unit integer value. Can be a negative number

positionProperty in the "Catch up" this display rule is not a compatibility problem, so, to think of an element shown above, directly on the back can be, without z-index.

Flooding is z-index both a waste of code, and not conducive to later maintenance and acceptance of others, why not throw it away. Remember, this is not the world z-index .


CSS style, set Z-index to 999 or very large, what does it mean? Z-index is a special property for the display of a Web page. Because the display is a pattern that is shown is a two-dimensional plane, Has the x-axis and y-axis to represent positional properties. In order to represent three-dimensional concepts such as the stacking order of the upper and lower layers of a display element, the Z-index attribute is introduced to represent the difference between Z-axes. Represents the upper and lower three-dimensional relationship of an element in the stacking order. According to the CSS2.1 specification, ' Z-index ' Applies to the anchor element (the ' position ' attribute is not static), it accepts an integer value, and the default value is auto.

It means ' z-index ' only works when the layer has absolute or relative positioning, and ' Z-index ' defaults to Auto.

If 2 or more than 2 of the layers through absolute or relative positioning overlap, this time the value of ' Z-index ' who is the big on the top of that layer display! The purpose of setting a value of 999 or larger than 999 is to ensure that the layer can always be displayed at the top!

The role of Zoom:1 and Z-index in CSS

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.