HTML Validation

From Coder Merlin
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>