Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what does \ mean in a css hex color notation?

Tags:

css

I'm curious what something like this means in CSS:

background-color: #080808 \9;

I know the hex color notation, of course, but I've never seen \9 used before. Even looking at the w3c, I'm not sure they define it either: color units

like image 437
tvpmb Avatar asked Sep 19 '12 18:09

tvpmb


People also ask

What is hex code format of CSS colors?

A hexadecimal color is specified with: #RRGGBB, where the RR (red), GG (green) and BB (blue) hexadecimal integers specify the components of the color.

How do you read a hex code?

Hex color codes start with a pound sign or hashtag (#) and are followed by six letters and/or numbers. The first two letters/numbers refer to red, the next two refer to green, and the last two refer to blue. The color values are defined in values between 00 and FF (instead of from 0 to 255 in RGB).

What do color hex codes mean?

Hex color codes are values that tell the display how much of a color to show. The values are a special code that represents color values from 0 to 255. If red, green, and blue are all at the minimum 0 (represented as “00” in the code), the color expressed is the color black.

What do the 6 digits of a hexadecimal color code represent?

Hex Codes Represent Red, Green and Blue Zero red, zero green and zero blue produces black. In fact, equal levels of red, green and blue, whatever that level may be, will always produce a shade of gray. The six digits of a hex code are in fact three two-digit numbers, each representing the level of red, green and blue.


2 Answers

That's an old Internet Explorer hack

\9 hack WORKS for: IE8 IE8 Standards, IE8 IE7 Standards, IE8 Quirks mode, IE7 Quirks, IE7 Standards (all varieties of IE8), IE6

So, in short, if you want an IE CSS hack that works in all flavors of IE, use the backslash-nine hack.

source

like image 131
Zoltan Toth Avatar answered Oct 06 '22 13:10

Zoltan Toth


2 CSS Rules Specific to Explorer (IE CSS hacks)

Another option is to declare CSS rules that can only be read by Explorer. For example, add an asterisk (*) before the CSS property will target IE7 or add an underscore before the property will target IE6. However, this method is not recommended because they are not valid CSS syntax.

IE8 or below: to write CSS rules specificially to IE8 or below, add a backslash and 9 (\9) at the end before the semicolon.

Found here. I must give credit to @Zoltan because I didn't know what to google till he posted.

It also has some other examples of IE specific web stuff. Like conditional comments which help when wanting to load things only in IE to handle IE unique cases.

like image 41
Dan Avatar answered Oct 06 '22 13:10

Dan