Skip to content

Html Overview

Whether you are a beginner or an expert in Hyper Text Markup Language (HTML) it is important to follow some best practices in order to keep your HTML documents consistent and organized. With so many elements, attributes, properties, values, and more — there is a lot to learn.

<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
</html>

Use proper document structure

HTML documents will still work without elements such as , , and . However, the pages will not render correctly in every browser so it’s important to be consistent in using the proper document structure.

Declare the correct doctype

When creating an HTML document, the first thing to declare is the doctype. This will tell the browser the standards you are using to render your markup correctly. The doctype goes before the tag at the top of the page. If you are unsure about what declaration to use, W3.org provides information on choosing the right doctype.

Don’t use inline styles

It may seem like an easy route to place styling in line with the code instead of creating an external style sheet. However, inline styles are not a good coding practice because it makes it harder to update and maintain a website. Instead, keep your styles separate from your HTML mark-up.

Use lowercase markup

Your HTML markup can be written in lowercase or uppercase and the web page will render correctly. However, it is best practice to keep tag names in lowercase because it is easier to read and maintain.

Keep indentation

Browsers do not need indentation to read HTML, however it is a good practice as they keep a visual hierarchy which helps us understand how elements are related.