HTML

Last Updated: 9/15/2022

Anatomy of an Html Document

Basic Structure

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    Hello World
</body>
</html>

DOCTYPE

<!DOCTYPE html>

  • The doctype declaration represents the document type.
  • Here it defines that this document is an HTML5 document.
  • It must only appear once, at the top of the page before any HTML tags.

HTML

<html></html>

  • This element is the root element of an HTML page
  • It wraps all the content on the page.

<head></head>

  • This element contains meta information about the HTML page
  • The head's content is not displayed on the page
  • Head includes keywords, description etc

META

<meta charset="utf-8">

  • This element specifies the character set for your document to UTF-8, which includes most characters from the vast majority of human written languages.
  • With this setting, the page can now handle any textual content it might contain.

TITLE

<title></title

  • This element specifies a title for the HTML page which is shown in the browser's title bar or in the page's tab

BODY

<body>

  • This element defines the document's body, and is a container for all the visible contents, such as headings, paragraphs, images, hyperlinks, tables, lists, etc.