HTML and CSS Reference
In-Depth Information
Validating Your Pages
When your newly coded page is not looking like you expect, what's your best first step?
Validate! Validating your web pages ensures a baseline functionality and rules out misspelled
or missing HTML tags. Furthermore, valid HTML is web standards-compliant and, to the
best of current capabilities, future-proof. Validation is a straightforward process made much
simpler by the freely available online tools explored in this lesson.
workinG wiTH THe HTML5 docTyPe
Because several versions of HTML are in use, validators rely on a bit of code to establish
which version the page is to be judged against. This code is the document type declaration or
doctype . As noted in Lesson 2, the doctype for HTML5 is very simple:
<!DOCTYPE html>
Although you should use the simplified doctype in the preceding example when
coding pages with HTML5, it is entirely likely you'll encounter pages written
with an earlier version of HTML. The World Wide Web Consortium (W3C)
maintains a list of document type declarations for prior HTML versions at .
For browsers and validators to work properly — and, in accordance with HTML syntax — the
doctype must be the first line of code in your web page.
So what happens if you don't include a doctype ? The biggest impact occurs when a browser
tries to render the page. Without clear guidelines of which version of HTML to rely on, a
browser is left to make its own assumptions and guess how to interpret the page. This results
in slower processing and possibly an inaccurate display.
Search WWH ::

Custom Search