Internet Explorer Hacks

Internet Explorer Hacks
Published on 2021-07-09 07:09:47

Adding Inline Block support to IE6 and IE7

display: inline-block;

The display property with the value of inline-block is not supported by Internet Explorer 6 and 7. A workaround for this is:

zoom: 1;
*display: inline;

The zoom property triggers the hasLayout feature of elements, and it is available only in Internet Explorer. The *display makes sure that the invalid property executes only on the affected browsers. Other browsers will simply ignore the rule.


High Contrast Mode in Internet Explorer 10 and greater

In Internet Explorer 10+ and Edge, Microsoft provides the -ms-high-contrast media selector to expose the "High Contrast" setting from the browser, which allows the programmer to adjust their site's styles accordingly.

The -ms-high-contrast selector has 3 states: active, black-on-white, and white-on-black. In IE10+ it also had a none state, but that is no longer supported in Edge going forward.


@media screen and (-ms-high-contrast: active), (-ms-high-contrast: black-on-white) {
background: #fff;
color: #000;

This will change the header background to white and the text color to black when high contrast mode is active and it is in black-on-white mode.

@media screen and (-ms-high-contrast: white-on-black) {
background: #000;
color: #fff;

Similar to the first example, but this specifically selects the white-on-black state only and inverts the header colors to a black background with white text.


Internet Explorer 6 & Internet Explorer 7 only

To target Internet Explorer 6 and Internet Explorer 7, start your properties with *:

.hide-on-ie6-and-ie7 {
*display : none; // This line is processed only on IE6 and IE7

Non-alphanumeric prefixes (other than hyphens and underscores) are ignored in IE6 and IE7, so this hack works for any unprefixed property: value pair.


Internet Explorer 8 only

To target Internet Explorer 8, wrap your selectors inside @media screen { }:

@media screen {
.hide-on-ie8 {
display : none;

Everything between @media screen { } is processed only by I

ATutorialHub Related Guide

Comments (9)

Leave a Comment

Your email address will not be published. Required fields are marked*

User Comments

html tutorial comments

panduranga gupta

2021-07-05 07:03:13

good website for learning and help me a lot

html tutorial comments


2021-09-25 14:58:47

The awsome website i am looking like for a long time, good work atutorialhub team keep doing

html tutorial comments


2021-09-01 15:03:56

Learning a lot from the courses present on atutorialhub. The courses are very well explained. Great experience

html tutorial comments


2021-09-10 15:05:45

It is very helpful to students and easy to learn the concepts

html tutorial comments


2021-09-14 15:06:41

Great job Tutorials are easy to understand Please make use of it

html tutorial comments

Zain Khan

2021-09-18 15:07:23

Great content and customized courses.

html tutorial comments

Rudrakshi Bhatt

2021-09-09 15:08:10

Well structured coursed and explained really well!

html tutorial comments

Pavana Somashekar

2021-09-11 15:09:08

Good platform for beginners and learn a lot on this website

html tutorial comments


2021-09-25 19:35:50

Nice website