Difference between revisions of "HTML Validation"

From Coder Merlin
m (Editorial review and minor corrections)
 
Line 1: Line 1:
== HTML Validator ==
== HTML Validator ==
The site https://validator.w3.org provides an HTML Validation service which can (and should) be used to validate HTML pages. It's very easy to use. Simply copy your URL from the browser's URL bar and paste it in the address textbox validator, then press the "Check" button.
The site https://validator.w3.org provides an HTML Validation service that you can (and should) use to validate HTML pages. It's very easy to use. Simply copy your URL from the browser's URL bar and paste it in the address textbox validator, then click "Check."
{{ResponsiveImage|[[file:W3CMarkupValidationService.png|link=|W3C Markup Validation Service]]}}
{{ResponsiveImage|[[file:W3CMarkupValidationService.png|link=|W3C Markup Validation Service]]}}
== Common Errors ==
== Common Errors ==

Latest revision as of 18:19, 24 September 2022

Within these castle walls be forged Mavens of Computer Science ...
— Merlin, The Coder

HTML Validator[edit]

The site https://validator.w3.org provides an HTML Validation service that you can (and should) use to validate HTML pages. It's very easy to use. Simply copy your URL from the browser's URL bar and paste it in the address textbox validator, then click "Check."

   W3C Markup Validation Service

Common Errors[edit]

Missing "lang attribute"[edit]

😲 Message: Consider adding a lang attribute to the html start tag to declare the language of this document.
✅ Fix: Include a language attribute in the html start tag:

<html lang="en">

Character encoding was not declared[edit]

😲 Message: The character encoding was not declared. Proceeding using windows-1252.
✅ Fix: Include a meta element with a charset attribute immediately after the opening <head> tag

<head>
  <meta charset="utf-8">

Start tag seen without doctype[edit]

😲 Message: Start tag seen without seeing a doctype first. Expected <!DOCTYPE html>
✅ Fix: Include a !DOCTYPE as the first tag

<!DOCTYPE html>