Jump to content

further learning on code validation


Abby

Recommended Posts

I feel as if I have only the shakiest grasp on the how & why of code validation. For this page of my site-in-progress, my Firefox browser says it's in Standards Compliance Mode. However, the error console on my toolbar shows a bunch of warnings, like these:Warning: Error in parsing value for 'float'. Declaration dropped.Line: 49Warning: Expected color but found 'invert'. Error in parsing value for 'outline-color'. Declaration dropped.Line: 59Warning: Expected end of value but found ':'. Error in parsing value for 'font-family'. Declaration dropped.Line: 146I don't know what any of that means.When I choose "validate CSS," I get this error:8 Unrecognized link element or xml-stylesheet PI. No idea what that means.And "validate HTML" comes up with 22 errors and warnings. Is it because I should be using a transitional dtd instead of a strict one?Is this really stuff that I need to worry about? Does it have any effect for the end user?

Link to comment
Share on other sites

A DTD defines the standards by which a browser will try and render your page by. Transitional plays a little loose and faster with the rules. Strict will ensure that all browsers interpret your code to the strictest standards, thus ensuring an optimum viewing environment for the user. If you plan on taking this seriously (as your site would imply), it is best to validate your code often during the development process, to understand what causes them, and also so you are only fixing a few at a time. Be aware that both CSS and HTML codes should be validated to comply with standards. The more errors there are, the more you leave up to the browser to interpret; sometimes they handle it, sometimes they don't. As for the CSS, you are getting those errors because (if you validate it):

7 body Value Error : font-family attempt to find a semi-colon before the property name. add it42 #andbar li Value Error : float top is not a float value : top top139 h2 Value Error : font-family attempt to find a semi-colon before the property name. add it
consult the CSS tutorials and find out what the acceptable values are for the respective properties.
Link to comment
Share on other sites

Warning: Error in parsing value for 'float'. Declaration dropped.Line: 49This means that it found a value for the CSS float property that it wasn't expecting. Float can only have left, right or none as a value.Warning: Expected color but found 'invert'. Error in parsing value for 'outline-color'. Declaration dropped.Line: 59The value for the ouline-color CSS property has to be a color, but it found "invert" instead. A color can be a hexadecimal number (#FFFFFF), an RGB declaration ( rgb(255,255,255) ) or a color name ( white )Warning: Expected end of value but found ':'. Error in parsing value for 'font-family'. Declaration dropped.Line: 146It sounds like a colon ':' was found after your font names, rather than a semi-colon ';'.8 Unrecognized link element or xml-stylesheet PI. I'm not sure why it's showing that. It would mean that there was some problem in the code you're using to load an external stylesheet. However, you don't seem to have a <link> element or a processing instruction loading an external stylehseet.

And "validate HTML" comes up with 22 errors and warnings. Is it because I should be using a transitional dtd instead of a strict one?
If you changed to Strict you will likely find even more errors.
Is this really stuff that I need to worry about? Does it have any effect for the end user?
You could ignore validation, but in the future it may come back to haunt you. Having a valid page means that your site will be interpretted properly by browsers. Pages that aren't valid often rely on browser-specific "features" and have problems when browsers upgrade or when people use a new browser that has a different parsing engine.
Link to comment
Share on other sites

Most of your validation errors are the same thing: using a / character at the end of short tags, specifically your <img> and <br> tags. Fix those (remove the / )and the number of errors will look A LOT more manageable.

Link to comment
Share on other sites

When I choose "validate CSS," I get this error:8 Unrecognized link element or xml-stylesheet PI. No idea what that means.
Normally, when you validate CSS, the validator expects you to either give a link to a ".css" file, or an (X)HTML file that points to a separate ".css" file. What you have instead is an HTML file that has the CSS within it. So, what this error message says is that it didn't recognized a <link> element that links to a ".css" file.Move your CSS into a separate file (it doesn't matter how you call it... for the purpose of example, let's say "style.css"), and from your HTML's head, link to it like:
<link rel="stylesheet" type="text/css" href="/style.css">

As for the "xml-stylesheet PI" part... you don't need to know that until you start dealing with XML. Just know it's another way to link to a ".css" file.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...