How Does This Work

W

Wayne Wengert

When a css statement such as the following is executed what really happens
to the color:

background-color: #cff;

I am used to colors specified as bgcolor = "#xxxxxx" and am not sure how the
above works?

TIA

Wayne
 
E

Els

Wayne said:
When a css statement such as the following is executed what really happens
to the color:

background-color: #cff;

I am used to colors specified as bgcolor = "#xxxxxx" and am not sure how the
above works?

#cff is just short for #ccffff

It's better to use the full version in some cases, but I
think it generally doesn't make a difference.
And in for example #c0f5a4 you can't make a 3 digit version,
of course.
 
W

Wayne Wengert

Els;

Thanks. I never knew that.

Wayne

Els said:
#cff is just short for #ccffff

It's better to use the full version in some cases, but I
think it generally doesn't make a difference.
And in for example #c0f5a4 you can't make a 3 digit version,
of course.
 
R

Richard

Wayne said:
When a css statement such as the following is executed what really
happens to the color:
background-color: #cff;
I am used to colors specified as bgcolor = "#xxxxxx" and am not sure how
the above works?

Wayne

The css has to be coded differently than the html version which is basically
the same thing.
Instead of "background-color:" you can also use just "background:"
In the html version the bg means background.
The colon replaces the =" ".

In css, many of the key words having hyphens, can be shortened to the main
word.
Background-color becomes background.
Margin-left becomes margin.
Padding-left becomes padding.


Background: has 5 subelements.
Each of the 5 elements can be placed after background: seperating each with
a space.

Background: #abc url("images/file.jpg") top center fixed;

What I just did was make the background a certain color, then place an image
on it and position it at the top center of the page, and making it stay
there when the page is scrolled by the user.
It's a shortcut to having to code a new line for each element.

http://www.stoneware.dk/english/default.htm

This editor has a complete library of html, javascript and css elements and
attributes.
 
S

Sid Ismail

: When a css statement such as the following is executed what really happens
: to the color:
:
: background-color: #cff;
:
: I am used to colors specified as bgcolor = "#xxxxxx" and am not sure how the
: above works?


cff = ccffff
abc = aabbcc

Sid
 
D

Dennis M. Marks

I have read the following message from "Wayne Wengert"
<[email protected]>
and have decided to lend my vast knowledge.

The writer said:
When a css statement such as the following is executed what really happens
to the color:

background-color: #cff;

I am used to colors specified as bgcolor = "#xxxxxx" and am not sure how the
above works?

TIA

Wayne

and my reply is:
Leading zeros have been dropped as in the decimal system. #cff = #000cff

If you are asking how it PHYSICALLY works, who knows? Logically it is
the same except you can group all specifications.
 
M

Mark Parnell

Leading zeros have been dropped as in the decimal system. #cff = #000cff

No they haven't. The 3-digit hex codes are the same as the 6 digit code,
where each of the digits in the 3-digit code is 2 digits in the 6-digit
code.

E.g. #cff = #ccffff
#aaa = #aaaaaa
#123 = #112233
#00a = #0000aa

etc.
 
S

Steve Pugh

Dennis M. Marks said:
I have read the following message from "Wayne Wengert"
<[email protected]>
and have decided to lend my vast knowledge.

Is this deliberate irony?
Leading zeros have been dropped as in the decimal system. #cff = #000cff

That is completely wrong. Please check the specs and actually learn a
bit about CSS instead of posting rubbish like this. Or are you just
trolling?

As several other people have already posted, #cff = #ccffff which is a
very different colour to #000cff.

Steve
 
R

rf

Dennis M. Marks said:
I have read the following message from "Wayne Wengert"
<[email protected]>
and have decided to lend my vast knowledge.

The writer said:

and my reply is:

Why do you keep saying this? It is obvious that this is your reply :)
Leading zeros have been dropped as in the decimal system. #cff = #000cff

Nope. See other replies in this thread. #cff == #ccffff, as in #123 ==
#112233.
If you are asking how it PHYSICALLY works, who knows?

See above.

Cheers
Richard.
 
D

Dennis M. Marks

I have read the following message from Mark Parnell
<[email protected]>
and have decided to lend my vast knowledge.

The writer said:
No they haven't. The 3-digit hex codes are the same as the 6 digit code,
where each of the digits in the 3-digit code is 2 digits in the 6-digit
code.

E.g. #cff = #ccffff
#aaa = #aaaaaa
#123 = #112233
#00a = #0000aa

etc.

and my reply is:
After further research I have to admit that you are right. This seems
to be a standard that was set up to create shorter color codes. The hex
values are not "mathematically equal" but they represent the same
color. The 6-digit colors give you more control but 3-digit colors are
good enough for the web.
 
M

Mark Parnell

Sometimes silence is taken as approval. :-(

Sometimes. Mind you this is the first time I have seen anyone comment on
it (not just in this thread).

Hopefully I have made my position clear now. :)
 

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,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top