Document structure

  • Doctype defines type of the HTML document
  • html is root element of the HTML document
  • head element defines a header of the HTML document
  • body element defines a body of the HTML document
<!DOCTYPE html>
<html lang="en">


Document type

Since HTML 5 only html type allowed

<!-- HTML 5 -->
<!DOCTYPE html>

<!-- Couple old types for example -->

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 

The head element is a container for metadata of the HTML document. This part not visible for user but used by browsers, search engines and other web services. Next elements allowed inside head element:

  • base specifies a base for all relative urls and a default target for all links on a page
  • link defines a link between a document and an external resource like css
  • meta defines metadata of a document
  • title defines a title of a document
  • script defines a client-side script, usually on JavaScript language
  • style defines how HTML elements should render in a browser
  <meta charset="UTF-8">
  <meta name="description" content="some text">
  <meta name="keywords" content="HTML,CSS,JavaScript">
  <meta name="author" content="FirstName LastName">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link rel="stylesheet" href="/css/bootstrap.min.css">
  <script src="/js/jquery-3.4.1.min.js"></script>
  <title>document title</title>
      a mark{
          text-decoration: underline;
          text-decoration-color: #0a5ffe;

Element body

The body element is a container for the document's body. It can contain text, hyperlinks, images and other content visible to the user.