- Do not add blank lines without a reason.
- Add 4 spaces of indentation. Do not use TAB.
- Add blank lines to separate large or logical code blocks.
<!-- Bad -->
<section>
<h1>Moscow</h1>
<p>
<strong>Moscow</strong> is the capital and the largest city of Russia with 12.2 million residents within the city limits and 16.8 million within the urban area. Moscow is one of three federal cities in Russia.
</p>
</section>
<!-- Good -->
<section>
<h1>Moscow</h1>
<p><strong>Moscow</strong> is the capital and the largest city of Russia with 12.2 million residents within the city limits and 16.8 million within the urban area. Moscow is one of three federal cities in Russia.</p>
</section>
And do it as the first line in your document.
<!doctype html>
Declaring a language is important for accessibility applications (screen readers) and search engines. Language can be found in the list.
<html lang="en-US">
UTF-8 (Unicode) covers almost all of the characters and symbols in the world.
<meta charset="utf-8">
The <title>
element is required in HTML5.
<title>Make the title as meaningful as possible</title>
<link rel="stylesheet" href="/path/to/styles.css">
<script src="/path/to/script.js">
See HTML5 layout.
Lowercase look cleaner and are easier to write.
<!-- Bad -->
<Header>
<A class="logo" href="//example.com/"></A>
</Header>
<!-- Good -->
<header>
<a class="logo" href="//example.com/"></a>
</header>
<!-- Bad -->
<section>
<p>This is a paragraph.
<p>This is a paragraph.
</section>
<!-- Good -->
<section>
<p>This is a paragraph.</p>
<p>This is a paragraph.</p>
</section>
<!-- Bad -->
<meta charset="utf-8" />
<!-- Good -->
<meta charset="utf-8">
<!-- Bad -->
<a CLASS="link" Href="//example.com/">Link</a>
<!-- Good -->
<a class="link" href="//example.com/">Link</a>
<!-- Bad -->
<a class=logo href=//example.com/></a>
<!-- Good -->
<a class="logo" href="//example.com/"></a>
Always use the alt attribute with images. It is important when the image cannot be viewed.
Always define image size. It reduces flickering because the browser can reserve space for images before they are loaded.
<img src="/path/to/picture.png" alt="alt of picture" width="128" height="128">
<!-- Bad -->
<link rel = "stylesheet" href = "styles.css">
<!-- Good -->
<link rel="stylesheet" href="styles.css">