Writing HTML Tags
Tags tell the browser what kind of content an element contains.
Opening tags, content, and closing tags
Most elements have an opening tag, some content, and a closing tag. The closing tag has a slash before the tag name. Together, these parts make an element.
<p>This is a paragraph.</p>
Elements can go inside other elements. Close the most recently opened element first.
<p>A paragraph with <strong>important text</strong>.</p>
Page structure and nesting
HTML elements are nested when one element is placed inside another. A complete page is inside the html element. Inside it, the head holds page information and the body holds the visible page. Within the body, elements such as div and section group related content, and those groups can contain headings, paragraphs, images, and other elements.
<html lang="en">
<head>
<title>A Page About Space</title>
</head>
<body>
<main>
<section>
<h1>Planets</h1>
<p>Our solar system has eight planets.</p>
</section>
</main>
</body>
</html>
Indent nested elements to make the structure easy to see. Close elements in reverse order: the last element opened should be the first one closed.