Monday, March 22, 2010

CSS warnings

HI I am trying to learn how to orgainze my CSS better and
reduce the number of styles and classes I use to be more effecient
with my CSS.

when I try to validate my CSS, while it does validate, where
ever I have a color stated for any form of text and I have not
specificially set BG color in that element (normally I just set the
colour in the body or to container) a warning is listed on
validation page. While I comprehend the essence of the warning I
think it looks bad.



Is the most correct way to implement CSS to state BG colour
for every style like:

p {

font-size : 0.8em;

color : #333333;

background: #fff

}

h1 {

font-size : 0.8em;

color : #000;

background-color : #fff;

}

h2{

font-size : 0.7em;

color : #ffcc00;

background-color : #fff;



}



CSS warnings


%26gt; Is the most correct way to implement CSS to state BG
colour for every

%26gt; style

%26gt; like:



Backgrounds are usually (always?) inherited. As such, the
easiest solution

is to just give the BODY tag a background color via CSS and
then only apply

background colors to the particular elements that you need
them on.



-Darrel





CSS warnings




Thanks for your reply,



that is what I thought but when doing it that way creates so
many warnings in W3C CSS validator do most designers just not worry
about the warnings?



Shontelle
%26gt; that is what I thought but when doing it that way
creates so many warnings

%26gt; in W3C CSS validator do most designers just not worry
about the warnings?



Warnings are really just assumption the software makes not
being able to

reason like a human. So, often they can safely be ignored if
you can clearly

see they don't apply to your situation.



-Darrel






shonts wrote:

%26gt; doing it that way creates so many warnings in W3C CSS
validator



The reason for the warnings is because users can set their
own

preferences for colours and styles. Somebody with visual
problems might

decide to set a user preference for the background to be a
particular

colour. If that colour is very similar to the colour you have
chosen for

text, your text becomes illegible. That's why you're
recommended to set

both foreground and background colours. However, I suspect
that most

designers ignore this advice.



--

David Powers, Adobe Community Expert

Author, ''The Essential Guide to Dreamweaver CS3'' (friends of
ED)

Author, ''PHP Solutions'' (friends of ED)


http://foundationphp.com/

  • ink cartridge
  • blush
  • eye liquid
  • No comments:

    Post a Comment