Jump to content

CSS validation issues.


Yuval200

Recommended Posts

Hello guys,some days ago, I desided to try to validate my CSS file, I fought it would be valid from the start, it did, sorta'.I had 7 errors, somthing like that;

  • Line : 7 font-family: You are encouraged to offer a generic family as a last alternative Line : 7 (Level : 2) font-family: You are encouraged to offer a generic family as a last alternative : body

  • I had a problem (more of a warning), that said that I declaired(sp?) a color attribute, but I didn't declaired a background-color attribute, I fixed that, but I found it pesky abit when using forms, is that mendetory?

I couldn't find a way to fix the first problem, can you guys help me?Thanks,Yuval.

Link to comment
Share on other sites

Are these errors that keep your css from validation? Or does it validate and just give a warning? If it's only a warning, just ignore it. If it's an error, try adding in arial as the last font listed. Like this.

body{font-family: "your font", times;}

It will still use whichever font you declare first, but it will also let you pass validation.

Link to comment
Share on other sites

[*]I had a problem (more of a warning), that said that I declaired(sp?) a color attribute, but I didn't declaired a background-color attribute, I fixed that, but I found it pesky abit when using forms, is that mendetory?
To pass validation you need to specify both a color and background-color and not leave it to the browser default.What do you mean you found it pesky?you could try background-color:transparent
Link to comment
Share on other sites

Oh well-

W3C CSS Validator Results for file://localhost/C:\Yuval\programmingLanguages\PHP\wamp\www\Systems\postingSystem\css.cssTo work as intended, your CSS style sheet needs a correct document parse tree. This means you should use valid HTML.WarningsURI : file://localhost/C:\Yuval\programmingLanguages\PHP\wamp\www\Systems\postingSystem\css.cssLine : 7 font-family: You are encouraged to offer a generic family as a last alternative Line : 7 (Level : 2) font-family: You are encouraged to offer a generic family as a last alternative : body Line : 27 font-family: You are encouraged to offer a generic family as a last alternative Line : 27 (Level : 2) font-family: You are encouraged to offer a generic family as a last alternative : .sendText Line : 33 font-family: You are encouraged to offer a generic family as a last alternative Line : 33 (Level : 2) font-family: You are encouraged to offer a generic family as a last alternative : .sendBotton Valid CSS informationbody {font-family : "verdana", arial; font-size : small; text-align : left; color : black; background-color : white; } span.error {font-size : medium; color : red; margin-left : 20px; background-color : white; } .sendText {font-family : "verdana", arial; font-size : xx-small; } .sendBotton {font-family : "verdana", arial; font-size : xx-small; height : 23px; width : 70px; } .invBorder {border : 0 solid black; }
Those are the results after I added that "generic" family (notice what I wrote - "verdana", arial).What do they want from me :)?(scott100: what does that value do? The problem with setting the background color as white is that the borders of the inputs and textareas changes and become "un cool").
Link to comment
Share on other sites

Yuval, try it with times, not arial. The validator doesn't seem to like arial. I used times, and that particular error went away. Also, add the same font-family values to each of the mentioned elements, and all your warnings should go away.(body, .sendtext, .sendbutton)Are you using that url to try and validate your css? If your server isn't working, there should be an option to just copy/paste your css into the validator to check it that way. That may be why it isn't validating.

Link to comment
Share on other sites

Yuval, try it with times, not arial. The validator doesn't seem to like arial. I used times, and that particular error went away. Also, add the same font-family values to each of the mentioned elements, and all your warnings should go away.(body, .sendtext, .sendbutton)Are you using that url to try and validate your css? If your server isn't working, there should be an option to just copy/paste your css into the validator to check it that way. That may be why it isn't validating.

Well, I used times, and the result:
W3C CSS Validator Results for file://localhost/C:\Yuval\programmingLanguages\PHP\wamp\www\Systems\postingSystem\css.cssTo work as intended, your CSS style sheet needs a correct document parse tree. This means you should use valid HTML.WarningsURI : file://localhost/C:\Yuval\programmingLanguages\PHP\wamp\www\Systems\postingSystem\css.cssLine : 7 font-family: You are encouraged to offer a generic family as a last alternative Line : 7 (Level : 2) font-family: You are encouraged to offer a generic family as a last alternative : body Line : 27 font-family: You are encouraged to offer a generic family as a last alternative Line : 27 (Level : 2) font-family: You are encouraged to offer a generic family as a last alternative : .sendText Line : 33 font-family: You are encouraged to offer a generic family as a last alternative Line : 33 (Level : 2) font-family: You are encouraged to offer a generic family as a last alternative : .sendBotton Valid CSS informationbody {font-family : "verdana", times; font-size : small; text-align : left; color : black; background-color : white; } span.error {font-size : medium; color : red; margin-left : 20px; background-color : white; } .sendText {font-family : "verdana", times; font-size : xx-small; } .sendBotton {font-family : "verdana", times; font-size : xx-small; height : 23px; width : 70px; } .invBorder {border : 0 solid black; }

As you can see, I used times. WHY ME?

  • Note: I am using the second way to validate - by uploading the file from my comp.I saw the textarea there, I pested (sp?) the code, but it did not worked (the send botton wouldn't send).

Link to comment
Share on other sites

That's really weird. Not really sure what to tell you. Times validates on my css... so.. You may just have to wait until you can test it from a server. The weird thing is... it's giving that warning at line 7... and your font-family is listed on line 2...Try serif instead of times. And you don't really need the " around verdana. I don't know why I put them there. You only really need those when the font name is more than one word.This is how I have my fonts listed, and I don't get that warning."font-family: "MS PMincho", serif, times;"

Link to comment
Share on other sites

I did have the same "problem" I didn't really bother since it's a warning but I like when everything is perfect so...you have to put something like serif or sans-serif this is generic because it will load the serif or sans-serif font on the computer if the other are not find out...

Link to comment
Share on other sites

Well, we have progress, (sorry for not replying for some time, I was kinda bussy)After using the "serif" font after the verdana, it made some progress.But, even after I made the document valid, I didn't got the message of "Blabla validated CSS blablabla" and that valid CSS image.It said somthing about (X)HTML, even trough I used an external stylesheet :\!Here is what I got:

No error or warning foundTo work as intended, your CSS style sheet needs a correct document parse tree. This means you should use valid HTML.Valid CSS informationbody {font-family : verdana, serif; font-size : medium; color : black; background-color : white; } span.error {font-size : medium; font-weight : bold; color : red; margin-left : 20px; background-color : white; } .sendText {font-family : verdana, serif; font-size : x-small; } .sendBotton {font-family : verdana, serif; font-size : x-small; height : 23px; width : 70px; } table {text-align : left; } .invBorder {border : 0 solid black; } div.invBorder {border-left-width : 3px; } 

Link to comment
Share on other sites

But, even after I made the document valid, I didn't got the message of "Blabla validated CSS blablabla" and that valid CSS image.
I ran your css through the validator and it passed :)No error or warning found
It said somthing about (X)HTML, even trough I used an external stylesheet :\
That's nothing to do with your css validation, just reminding you that you need valid html also. :)
To work as intended, your CSS style sheet needs a correct document parse tree. This means you should use valid HTML.
Link to comment
Share on other sites

I ran your css through the validator and it passed :)No error or warning foundThat's nothing to do with your css validation, just reminding you that you need valid html also. :)

I know that it is valid, but unlike the validation page of w3s style sheet, it didn't said showed me the valid CSS image.Here is what was writen in the w3s stylesheet:
Congratulations! This document validates as CSS! To show your readers that you've taken the care to create an interoperable Web page, you may display this icon on any page that validates. Here is the HTML you could use to add this icon to your Web page: <p> <a href="http://jigsaw.w3.org/css-validator/">  <img style="border:0;width:88px;height:31px"      src="http://jigsaw.w3.org/css-validator/images/vcss"       alt="Valid CSS!"> </a></p>(close the img tag with /> if using XHTML)If you like, you can download a copy of this image to keep in your local web directory, and change the HTML fragment above to reference your local image rather than the one on this server. If you would like to create a link to this page (i.e., this validation result) to make it easier to re-validate this page in the future or to allow others to validate your page, the URI is:           http://jigsaw.w3.org/css-validator/validat...om/stdtheme.css      or http://jigsaw.w3.org/css-validator/check/referer (for HTML/XML document only)(Or, you can just add the current page to your bookmarks or hotlist.)To work as intended, your CSS style sheet needs a correct document parse tree. This means you should use valid HTML.
But I got only the last line.Wait, is it beacuse I'm validating my CSS via my computer, and not by a server?
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...