Simple Question?

A

Adrienne

Gaffer wrote:>>



Simple answer.
<hr color="white">
color can be name as shown, "#fff" -hex 8 bit, ""#ffffff" -hex 16 bit, or
"rgb(255,255,255)".

Better:

<hr style="color:#fff">

There is no color attribute for the HR element.
 
S

Sam Hughes

First of all, HTML colors can only come in two forms: one of 16 select
color names ("white" is one of them) or a 24-bit hexadecimal number
(#FFFFFF is 24 bit, not 16 bit).

#FFF is only allowed with CSS, whether or not IE still supports it in
HTML attributes. Also, it is 12 bits, not 8. rgb() syntax is also not
valid in HTML attributes; it is only valid in CSS.

Note that a hexidecimal number needs 4 bits (or one nibble) of storage
space to be
stored -- 16 = 2^4. Thus, a number with 6 hexidecimal digits requires 24
bits, while one with 3 hexidecimal digits requires 12 bits.
Better:

<hr style="color:#fff">

There is no color attribute for the HR element.

And the CSS color property applies to the text color. IE uses the color
property in its demented way; it renders the HR as blue even though HR
elements have no text. Other browsers use the background-color property.

Els's solution of <hr style="color: #fff; background-color: #fff;"> works
better.
 
A

Adrienne

First of all, HTML colors can only come in two forms: one of 16 select
color names ("white" is one of them) or a 24-bit hexadecimal number
(#FFFFFF is 24 bit, not 16 bit).

#FFF is only allowed with CSS, whether or not IE still supports it in
HTML attributes. Also, it is 12 bits, not 8. rgb() syntax is also not
valid in HTML attributes; it is only valid in CSS.

Note that a hexidecimal number needs 4 bits (or one nibble) of storage
space to be
stored -- 16 = 2^4. Thus, a number with 6 hexidecimal digits requires
24 bits, while one with 3 hexidecimal digits requires 12 bits.


And the CSS color property applies to the text color. IE uses the
color property in its demented way; it renders the HR as blue even
though HR elements have no text. Other browsers use the
background-color property.

Els's solution of <hr style="color: #fff; background-color: #fff;">
works better.

Absolutely agree, I think Els' message hadn't reached my news server yet.
 
R

Richard

Sam Hughes wrote:>>
First of all, HTML colors can only come in two forms: one of 16 select
color names ("white" is one of them) or a 24-bit hexadecimal number
(#FFFFFF is 24 bit, not 16 bit).

Not quite. A single hexadecimal unit is 8 bit. Two units makes it 16 bits.
8 bit is defined by "#000" and 16 by "#010101".



#FFF is only allowed with CSS, whether or not IE still supports it in
HTML attributes. Also, it is 12 bits, not 8. rgb() syntax is also not
valid in HTML attributes; it is only valid in CSS.

It is supported in versions 4 and above. In IE, netscape and mozilla as well
as others.
Note that a hexidecimal number needs 4 bits (or one nibble) of storage
space to be
stored -- 16 = 2^4. Thus, a number with 6 hexidecimal digits requires 24
bits, while one with 3 hexidecimal digits requires 12 bits.

In using rgb(00,00,00), the 3 sets of values automatically define it as 24
bit.
In the hex format, it is still 24 bit but defined by 3 pairs of values
writtten without the comma.
So technically we should have "#FF,00,FF".
As you should know, 8 bits = 255 possible combinations.
16 bits therefor = 65,005 possible combinations.
So "red" has 65,005 shades.
Although we refer to it as 24 bit "true color", it is not 24 bit in the
formatting. Not yet anyway.
 
O

Owen Jacobson

Richard said:
Not quite. A single hexadecimal unit is 8 bit. Two units makes it 16
bits. 8 bit is defined by "#000" and 16 by "#010101".

What, did you fail math?

Each hex digit can have a value from 0 to F (15). In binary, the
smallest (fewest-digits) representation is 0000 to 1111.

So how many hex digits do you get out of eight bits? 0011 1100 == #3C
[0]. #123 is, in fact, *three* groups of four bits. Twelve bits. Not
eight bits.

The logical leap from that to the size of #123456 is left as an
excercise to the reader.
It is supported in versions 4 and above. In IE, netscape and mozilla
as well as others.

Just because something is supported does not make it correct[1]. The
HTML specification, as published by the W3C, only permits six-digit hex
codes in the format #000000 and the sixteen keywords for colour.

The CSS specification, however, permits the wider range of colour
values, in the context of style attributes, style elements, and
external stylesheets. It says nothing at all about attribute values on
elements themselves.
In using rgb(00,00,00), the 3 sets of values automatically define it
as 24 bit.

No, the three values are integers ranging from 0 to 255. The
difference is subtle, but important.
In the hex format, it is still 24 bit but defined by 3 pairs of values
writtten without the comma.
So technically we should have "#FF,00,FF".
As you should know, 8 bits = 255 possible combinations.

So far, so good. Each of the three colour components in this notation
can have 256 (0-255 inclusive) values.
16 bits therefor = 65,005 possible combinations.

There's still three of them. Not two.

<snip the rest, it's incoherent>

Owen

[0] We're using HTML/CSS notation here, not C notation (0x..).

[1] <blink>
 
R

Richard

rf wrote:>>

<grin />
Yes. We should also tell him this:

I see no mention of a color attribute anywhere in the DTD entry for <hr>.
Some brower specific extensions (IE) allow the attribute.

The statement was that it could not be done.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top