Home > Web Front-end > CSS Tutorial > How Can I Fix the `display: inline-block` Incompatibility in Internet Explorer 7?

How Can I Fix the `display: inline-block` Incompatibility in Internet Explorer 7?

Patricia Arquette
Release: 2024-12-18 02:16:10
Original
750 people have browsed it

How Can I Fix the `display: inline-block` Incompatibility in Internet Explorer 7?

IE7 Display: Inline-block Incompatibilities

Internet Explorer 7 fails to recognize the display: inline-block; property, particularly for elements that are not naturally inline. To resolve this issue, apply an IE7-specific CSS hack:

.frame-header {
    height:25px;
    display:inline-block;   
    *display: inline;
    zoom: 1;
}
Copy after login

The hack consists of three parts:

  • *display: inline; - This overrides the display property for IE7 and lower, setting it to inline.
  • zoom: 1; - Triggers the hasLayout behavior, which is essential for inline-block functionality.

To avoid potential conflicts with other browsers, it's advisable to use a separate stylesheet for IE7 through conditional comments:

<!--[if IE 7]>
<link rel="stylesheet" href="ie7.css" type="text/css" />
<![endif]-->
Copy after login

The above is the detailed content of How Can I Fix the `display: inline-block` Incompatibility in Internet Explorer 7?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template