Reply to Re: Setting CSS property to another

Your name:

Reply:


Posted by Gιrard Talbot on 10/08/05 21:59

bcr07548@creighton.edu a Γ©crit :
> I was validating some CSS last night and kept getting warnings that my
> TD styles had a 'background-color' but no 'color.'

It's just that once you have define a background-color, you need to
define the color too (or vice versa). What makes a text legible is that
there is enough contrast between background-color and color to make it
distinguishible.

W3C Quality Assurance tip for Webmasters:
If You Pick One Color, Pick Them All
http://www.w3.org/QA/Tips/color

I didn't have one
> because I wanted the text to be the color specified in the page's style
> sheet. I thought that was the idea of CSS - styles "cascade" down and
> any property not found for a particular tag at that level are then
> searched for at higher levels of the DOM structure.
>

Yes, that's how inheritable properties work. Not all properties are
inheritable; not all properties are inherited from containers if they
are not specifically defined.
Every listed CSS 2.x property has a field indicating whether it is or
not inherited.

> Anyway, for the sake of having the CSS validate without warnings, I
> want to add color properties for the tags that need them. But for sake
> of maintainability, can you set one CSS property equal to another so
> you don't have to hunt down all the properties and change their values?
> For example,
>
> body
> {
> background-color: #000088;

That is light blue.

> color: #0000FF;

color blue is not best. blue on light blue is not that contrasting, easy
to distinguish, to read.

Effective Color Contrast
http://www.lighthouse.org/color_contrast.htm

The default color for unvisited links is set to blue in all modern
browsers. Personally, I would avoid doing that.


> }
>
> td
> {
> background-color: #000044;
> color: body.color;

color: inherit;

'color'
Value: <color> | inherit
Initial: depends on user agent


6.2.1 The 'inherit' value
http://www.w3.org/TR/CSS21/cascade.html#value-def-inherit

GΓ©rard
--
remove blah to email me

[Back to original message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация