Forum Moderators: not2easy

Message Too Old, No Replies

RGB Shorthand in CSS

not sure why they coded it like this...

         

newnewbie1

12:14 pm on Oct 18, 2003 (gmt 0)

10+ Year Member



Hi!
I am looking at a stylesheet that draws a dotted line around the paragraph. See code below:

.callouti {
margin : 0px;
padding : 0px 10px;
border-left : 1px dotted #BBB;
white-space : nowrap;
color : #777;
background : transparent;
}

Can anybody tell me why the colors have 3 numbers and a pound sign? I guess are those RGB colors. I usually use hex colors. I think this is a new stylesheet. How can you tell what browsers it's supported in?

THX!

dmorison

12:19 pm on Oct 18, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi THX,

Checkout this page at w3.org:

[w3.org...]

You are correct - 3 numbers is just RGB, as opposed to RRGGBB.

TGecho

3:01 pm on Oct 18, 2003 (gmt 0)

10+ Year Member



It's useful for shortening repetative colors like #dddddd. Not a big deal, but saves a little time and space.

synotic

9:24 pm on Oct 18, 2003 (gmt 0)

10+ Year Member



Can anybody tell me why the colors have 3 numbers and a pound sign? I guess are those RGB colors. I usually use hex colors. I think this is a new stylesheet. How can you tell what browsers it's supported in?

Your colors should always start with a

#
unless your expressing it in the
rgb()
format. Also, you're always using RGB. Each color is expressed as a combination of red, green and blue. You can have 255 hues of either red, green or blue. If you were using the
rgb()
format, then pure red, for example, would look like this:

rgb(255,0,0)

255 is the highest value you can use, it can also be expressed in hex, which you are familiar with like so:

#FF0000

When it's in the format of

#AABBCC
, then you can shorten it to
#ABC
. Any color value that you can do this to, is also a web safe color. Other color values such as
#B1EB4C
don't follow the same scheme therefore it's not a web safe color. Anyways, to recap:

#FF0000

rgb(255, 0, 0)

red

are all the same thing. They are also also all RGB. Does that make sense? :)

DrDoc

9:57 pm on Oct 18, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



How can you tell what browsers it's supported in?

To put it this way - even NN4 supports it! ;)

hartlandcat

7:35 am on Oct 19, 2003 (gmt 0)

10+ Year Member



Can anybody tell me why the colors have 3 numbers and a pound sign?

What pound sign? I don't see a pound sign, I see a hash like normal. This is a pound sign: £

aevea

6:01 pm on Oct 19, 2003 (gmt 0)

10+ Year Member



I think the hash/pound sign (#) is to show that it's a hex number and distinquish it from the color keywords:
The list of HTML4 keyword color names is: aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, purple, red, silver, teal, white, and yellow. The color names are case-insensitive.

Adam

hartlandcat

6:46 pm on Oct 19, 2003 (gmt 0)

10+ Year Member



Correct. I just fail to understand why people are calling it the pound sign, when it quite obviously isn't.

dmorison

6:48 pm on Oct 19, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I just fail to understand why people are calling it the pound sign, when it quite obviously isn't.

I don't think it's black and white; i've often heard # referred to as "pound"... it's an American thing...

[askoxford.com...]

MonkeeSage

10:09 pm on Oct 19, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



"#" is classically a "sharp" symbol in musical notation, but for some reason the telephone makers in the US decided it was a "pound" sign at some point. If you call to pay a bill or whatnot, many of the automated phone systems will tell you to 'press pound...' to access some option / menu or before your password. Some other people decided it was a "hash" sign, and others still decided it was a shorthand for the word "number"...humans are just quirky, what more can be said. ;)

Jordan

choster

10:50 pm on Oct 19, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



see 142.206.72.66/2003/06/s0700_e.htm
In the United States, it used to be the practice to use # to indicate weights in pounds on bills of lading.... In Britain they use a capital ‘L’ with a horizontal stroke through it (£) to denote their currency, the pound sterling; they use lb. to denote their unit of weight, the avoirdupois pound.

also www.wordsmith.org/awad/archives/1003 (scroll down to Wed. Oct. 8)

The symbol # is derived from a shorthand way of writing lb, the abbreviation for the Latin libra (balance), just as $ is a shorthand way of writing US.... The "#" is also known as a pound sign, crosshatch, number sign, sharp, hash, crunch, mesh, hex, flash, grid, pig-pen, gate, hak, oof, rake, fence, gate, grid, gridlet, square, and widget mark.

pageoneresults

11:34 pm on Oct 19, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Paired Color Values

Any time you have three pairs, you can utilize CSS shorthand to specify the hex color.