Understanding HTML5 Compliance & Proper Page Structure.

In HTML5
3 min read

HTML (HyperText Markup Language) is the standard markup language for documents designed to be displayed in a web browser. It uses tags that are enclosed in angle brackets to define elements such as headings, paragraphs, images, links, etc.

## Basic HTML Structure

The basic structure of an HTML document consists of a <html> tag and its closing </html> tag. Inside this tag is the <head> tag, which contains metadata about the page such as the title, character encoding, stylesheets, etc., and the `<body>` tag, which contains the content that will be displayed on the page.

Standard HTML5 Starting Code Template:

<!DOCTYPE HTML><br><html><br><head><br><title>Page Title</title><br></head><br><body><br>Content goes here<br></body><br></html>

Bonus Information – The HTML, HEAD, and Body tags are not required as per the HTML5 spec when used correctly. This helps reduce your overall HTML code on page, build a more structured web page, and enhance the SEO of your website, as there is less code for the spiders to parse.:

https://html.spec.whatwg.org/multipage/syntax.html#syntax-tag-omission

Example Of HTML5 Compliant Code:

<!DOCTYPE HTML>
<title>Hello</title>
<p>Welcome to this example.</p>

When Can these tags be Ommited?

  • An HTML element’s end tag may be omitted if a comment does not immediately follow the HTML element.
  • A head element’s start tag may be omitted if the element is empty or the first thing inside the head element is an element.
  • A head element’s end tag may be omitted if the head element is not immediately followed by ASCII whitespace or a comment.
  • A body element’s start tag may be omitted if the element is empty or if the first thing inside the body element is not ASCII whitespace or a comment, except if the first thing inside the body element is a meta, NoScript, link, script, style, or template element.
  • A body element’s end tag may be omitted if a comment does not immediately follow the body element.

HTML tags and their attributes are essential for creating web pages that are both accessible and usable. By understanding the basics of HTML, you can create more effective and efficient web designs that meet the needs of your users.

Comments

What is an HTML Tag? - Carlos Baez

[…] and content of a document to the browser, allowing it to render the page correctly. See Also Understanding HTML5 Compliance & Proper Page Structure For more efficient and code compliant HTML […]

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from Carlos Baez

Subscribe now to keep reading and get access to the full archive.

Continue Reading