Browser specific CSS rules you Must Memorize Part-2

By

September 27, 2012CSS1 Comment

As we have already discussed about Selector hack in browser-specific-css-rules-you-must-memorize-part-1 now we are going to focus on Attribute hack. 

ATTRIBUTE HACK :

Focusing a particular attribute of an element to write CSS is called as Attribute hack. In a <div> Element ID, name, class…etc are all attributes it applies for all HTML elements.

Below Example shows how to target specific browsers with Attribute hack,

In IE 6 you can use the below rule to apply CSS

#element_id { _color: blue }
.element_class { _color: blue }

In IE 6 & IE 7 you can use the below rule to apply CSS

#element_id { *color: blue } (or) #element_id { #color: blue }
.element_class { *color: blue } (or) .element_class { #color: blue }

To exclude in IE 6 you can use the below rule to apply CSS

#element_id { color/**/: blue } 
.element_class { color/**/: blue }

In IE 7 & IE 8 you can use the below rule to apply CSS

#element_id { color/*\**/: blue\9;} 
.element_class { color/*\**/: blue\9; }

In IE 6 & IE 7 !ie acts as an important

#element_id {  color: blue !ie; } 
.element_class {  color: blue !ie;  }

In IE 6 & IE 7 !ie acts as an important (ie string can differ after !)

#element_id {  color: blue !ie; } 
.element_class {  color: blue !ie;  }

In IE 8 & IE 9 must be written at the end of all rules

#element_id { color: blue\0/; } 
.element_class {  color: blue\0/;  }

This Browser specific CSS hack part 1 and part 2 helps web designers to get rid of the design issues in most of the major browsers. These kind of CSS hacks can be applied specific to the browsers with HTML conditional statements.

  • W

    OK THIS IS BULLCRAP I JUST WANT TO KNOW HOW TO HACK THE CSS FOR A MULTYPLAYER GAME.ITS ALMOST IMPOSSIBLE.