Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which color is #0000?

Tags:

html

css

I'm trying to guess which color is #0000

In the following code:

$('.example').css({"background-color":"#0000","opacity": "0.20", "filter": "alpha(opacity=20)" });

Replacing #0000 by any of the following colors don't produce the same effect:

#0000FF, #FF0000, #00FF00, #000000, #00000, #000

I thought any 3 o 4 digit color had a corresponding 6 digit color. I'm I wrong?

like image 479
villamejia Avatar asked Sep 05 '25 17:09

villamejia


1 Answers

From http://dev.w3.org/csswg/css-color/#hex-notation:

4 digits

This is a shorter variant of the 8-digit notation, "expanded" in the same way as the 3-digit notation is. The first digit, interpreted as a hexadecimal number, specifies the red channel of the color, where 0 represents the minimum value and f represents the maximum. The next three digits represent the green, blue, and alpha channels, respectively.

transparent, like rgba(0, 0, 0, 0.0)

not supported yet tho. From http://www.w3.org/TR/CSS2/syndata.html#parsing-errors:

Illegal values. User agents must ignore a declaration with an illegal value.

Here's a testcase. Yellow background = not supported. Transparent (white) background = supported.

http://jsfiddle.net/p5aJJ/

<div class="test">hello</div>

...

div {
    background-color: yellow;
}

div.test {
    background-color: #0000;
}
like image 83
guest Avatar answered Sep 07 '25 08:09

guest



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!