PDA

View Full Version : Code Validation Question


joroco
11-19-2006, 03:55 AM
ok so i know you should check/validate your code, so i done that and fix afew things but now im confused, as i understand from what i have read im doing stuff right but aparently not when i validate the code....

can someone try and explain afew things please?
and dont tell me to go and read it all again cause i have read it, over and over again... if i knew what i was doing wrong i wouldn't be writing here now would i? sorry if im alittle sarcastic but im tired, stuck and need help from someone else THATS WHY I WRITE HERE :thumbsup:

so here it is
* Line : 4 (Level : 1) You have no color with your background-color : html
* Line : 4 (Level : 1) You have no color with your background-color : html
* Line : 5 font-family: You are encouraged to offer a generic family as a last alternative
* Line : 5 (Level : 2) font-family: You are encouraged to offer a generic family as a last alternative : html
* Line : 5 (Level : 2) font-family: You are encouraged to offer a generic family as a last alternative : html
* Line : 13 (Level : 1) You have no background-color with your color : h1
* Line : 21 (Level : 1) You have no background-color with your color : h2
* Line : 28 (Level : 1) You have no background-color with your color : h3
* Line : 36 (Level : 1) You have no background-color with your color : h4
* Line : 43 (Level : 1) You have no background-color with your color : p
* Line : 50 (Level : 1) You have no background-color with your color : ul
* Line : 57 (Level : 1) You have no color with your background-color : #container
* Line : 65 (Level : 1) You have no color with your background-color : #header


here is the CSS aswell
body, html {
margin: 0;
padding: 0;
background-color: #696969;
font-family: "Arial", "Verdana", "Trebuchet MS", "Tahoma";
font-size: 1em;
}

h1 {
margin: 0;
padding: 0;
font-size: 1.2em;
color: #FFFFE0;
font-weight: bold;
}

h2 {
margin: 0;
padding: 0;
font-size: 1.2em;
color: #FFFFE0;
}

h3 {
margin: 0;
padding: 0;
font-size: 1em;
color: #FFFFE0;
font-weight: bold;
}

h4 {
margin: 0;
padding: 0;
font-size: 0.9em;
color: #FFFFE0;
}

p {
margin: 0;
padding: 0;
font-size: 0.7em;
color: #FFFFE0;
}

ul {
margin: 0;
padding: 0;
font-size: 0.6em;
color: #FFFFE0;
list-style: disc;
}

#container {
margin: 0;
padding: 0;
background-color: #778899;
width: 700px;
height: auto;
}

#header {
margin: 0;
padding: 0;
background-color: #FFD700;
width: 700px;
height: 200px;
}

the background-color thing, do i have to set a background-color for everything? :confused: is that not adding more code there for taking away the use of css alittle? isn't it supposed to be that there is less code and the **** loads quicker?
and the "You have no color with your background-color : #header" that i really dont get... i have a background color with #header.. and the color i took from W3.orgs color chart..

EDIT : FOUND THE PROBLEM... IT MENT background-color: #fff; color: #fff; Sometimes all that is needed is a break, smoke and a trip to the toilet to fix the problem hahaha

and the generic family thing i dont understand.. what other "code" can i set font styles with? :confused:

HOPE SOMEONE CAN EXPLAIN THESE THINGS CAUSE I JUST DONT GET IT AND IM TIRED!! :thumbsup: :confused:

THANKS ALL, hope you've got a sense of humour, a little understanding and dont get "offended" in anyway! :cool:

joroco
11-19-2006, 04:45 AM
#header {
color: #fff;
background-color: transparent;
}

whats wrong with that?

trying to "validate" the **** again,
http://www.w3schools.com/css/tryit.asp?filename=trycss_background-color
check out "H2" ...
when i write and get it "VALIDATED" it says "Line : 2 (Level : 1) You have no background-color with your color : #header"
BUT THE THING IS I DO! OR DO I? IM CONFUSED NOW!

harbingerOTV
11-19-2006, 04:58 AM
Well I guess it's that transparent isn't a color. Your not getting errors just warnings.

Basically it wants a background color with every block level element. Not required but i's more like when a user has images off and there is text in an element, if you have a background color then the text will be visible. I havent made a page yet that doesnt spit out a handfull of warnings fo rthat. When i turn off images I have the main elaments (body, container, etc...) haviong background colors so all's good.

So the generic font family:

you need a default and thats the generic. basically if someone doesnt have any of the fonts you specified, their machine reverts to the family default set on thier machine. yeah yeah babble babble. here we go:

font-family: tahoma, helmet, "trebuchet ms", arial, sans-serif;

font-family: georgia, times, "palatino linotype", serif;

font-family: rockwell, "my type of font", monospace;

font-family: "zapf dingbats", symbol;

font-family: porcelian, scriptina, "Comic Sans MS", cursive;

the last one in those is the default. If you specify a monospace fon t(think typewriter) and the viewer doesnt have rockwell oy "my type of font" then it defaults to whatever thier monospace font is. Usually thats some form of courier on windows machines.

joroco
11-19-2006, 05:26 AM
ok so those background warnings i can just ignore? :)

thanks for the generic font thing... finally someone that can write it and explain it simply so everyone can understand it :thumbsup:

you have no idea how much you helped me then :thumbsup:
was really starting to get annoyed with this validating thing haha...

THANKS!! :thumbsup:

P.S. you should write some easy explained tutorials :) i mostly find tutorials and "tips" for people that already understand like everything... so there not much use to me at all...

harbingerOTV
11-19-2006, 05:49 AM
Well thanks. Some of this stuff is rather perplexing to me as well.

When I started off, I found a lot of tutorials geared more to the "i already know some stuff" crowd. being as such they didnt really explain the "simple" things in depth to the point that it hits home and you remeber the base of it. Oh and before the beer sets in... don't ever use cursive or symbol as a font-family. Personal preference but a logical point is to be had. 99.999% of users never change theier font defaults in thier browsers. A page rendered in comic sans when not intended to is utter crap. no way around it. and symbol, well, they are suit for images. okay I digress.

okay so th ebackground color thing.

look at this:

http://www.cameronmoll.com/

kind of a sort of web guy well noted thing. One people look at and say yeah he knows his schtuff.

now look at this:

http://jigsaw.w3.org/css-validator/validator?profile=css2&warning=2&uri=http%3A%2F%2Fwww.cameronmoll.com%2F

see the warnings?

now go back to his site and if you use Firefox or flock or something and have a way to turn off images, do it.

see how all the text is still visible? Thats what the warnings are for. the validator can't determine if its going to work like that so it's up to the coder to make it work that way.

anywho...glad i could help out. have fun.

adamorjames
11-19-2006, 06:12 AM
As long as it doesn't say Errors before the "background-color" and all those other warnings then it's valid. Check my website aojweb.110mb.com, click on the "Valid CSS" image at the bottom of the home page.

Arbitrator
11-19-2006, 10:57 AM
when i write and get it "VALIDATED" it says "Line : 2 (Level : 1) You have no background-color with your color : #header"
BUT THE THING IS I DO! OR DO I? IM CONFUSED NOW!Yeah, this is a warning. Understand the warnings, but know that they can generally be safely ignored. If you find that you don’t like seeing the warnings, use the advanced interface and turn them off.

This particular warning is there for one reason: readability. It wants to make sure that you’ve (A) considered that your website is still readable even when images are disabled and (B) readable even when the user has custom font and background colors specified. The first is easy to test for; simply turn images off. The second is a bit more tricky. Say that you you expect the default font and background colors to be black and white, respectively. You change the font color to a shade of blue but leave the background color undefined because you just know it will be white. Then some user comes to your website with a custom-defined white font on a dark blue background which, taken together, are fine for reading. You’ve overridden the font color though so the font is blue, but now the background color, which was left undefined, defaults to dark blue and the page is unreadable. That’s what the warning is for.

There is one more reason to note that warning, but it only affects the general design: when you try to fake transparency on a white background by making the pseudo-transparent areas white, if you don’t explicitly define the background color to be white (you just assume the norm), then someone may waltz on over with a custom background color and suddenly the fake transparency becomes blatantly obvious.

font-family: "zapf dingbats", symbol; … don't ever use cursive or symbol as a font-family.I’m not sure if this was your intention, but Symbol isn’t the fifth generic font family; it’s fantasy. Fantasy fonts are those that are pictographic in nature but still readable as text. I don’t believe that there are any widespread fantasy fonts like there are for the other font families though, so you’re unlikely to see the keyword in action until then or perhaps until some of the standards‐compliant browser vendors get around to supporting the CSS2 @font at-rule or the CSS3 Web Fonts Module.

It should be noted that using symbol fonts is pointless in browsers such as Firefox, since they will re-map the symbol into the correct character. In other words, if you use the character A to produce a star in some symbol font, it will show as a star in Internet Explorer but as an A in Firefox. I believe that the purpose of the re-mapping is to make available characters that are not available in a given font; for example, if a font doesn’t include the square root character, the glyph for that character can be pulled from another font that does have that character available. It also makes sense when you look at it from a Unicode stand-point since U+0041 should always map to the capital letter A, not some arbitrary symbol.