Quantcast
Channel: girlswhogeek.com » validation
Viewing all articles
Browse latest Browse all 2

Fixing Common Validation Errors

$
0
0

When it comes to validating your web pages, it’s often easy to miss little things that are generally unimportant to the layout of the page but make the w3c validator throw a temper tantrum. I’ve compiled a list of common errors and warnings, and how to fix them.

No Character Encoding Found! Falling back to UTF-8.

This warning tells us that we’ve forgotten the content-type meta tag. You can see lots of information about content-type on my Basic Meta Tags tutorial, but the quickest and easiest is:
<meta http-equiv="content-type" content="text/html; charset=utf-8">
This goes between the <head> </head> tags in our document.

Generally you only need to modify the code above if you’re using a language with special characters not supported by UTF-8, or if your page is not “text/html”. If you have no idea what either of these things are/mean, leave them.

document type does not allow element “[tag]” here

This error is caused by putting an inline element straight into a page without a surrounding block-level element, or a block-level element inside an inline element. I see this most often with forms, whereby the webmaster has a typical form setup:

<form>
    <input type="text" name="name">
    <input type="submit" name="submit">
</form>

…but the input elements are inline, and must be surrounded by a suitable block-level element such as <fieldset> or the “make-do” <p>.

Note: the two most common block-level elements that I use on a day to day basis are <div> and <p>.

end tag for “[tag]” omitted, but its declaration does not permit this

This error is generally to tell us off for nesting tags incorrectly. That is, opening and closing tags in the wrong order. Tags must be closed “symmetrically” — that is, in the opposite way that they were opened. For example, this is wrong
<b>text <i>text</b></i>
We should close the <i> before the <b>, like so:
<b>text <i>text</i></b>

If you have a validation error or warning that you don’t understand, post in our forum

The post Fixing Common Validation Errors appeared first on girlswhogeek.com.


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images