Basic Structure (Must Know)

Basic HTML Page Structure

Understanding the entry point and foundational tags of a webpage.

Every HTML5 document requires a standard boilerplate structure to render correctly in web browsers.

Required Core Tags

  • <!DOCTYPE html>: Declares the document type as HTML5.
  • <html>: The root container for the document.
  • <head>: Stores document metadata, including settings, page title, CSS links, and script tags.
  • <title>: Defines the title shown on the browser tab.
  • <meta>: Specifies metadata like encoding and viewport responsiveness.
  • <link>: Links external resources like CSS stylesheets.
  • <style>: Internal CSS style block.
  • <script>: Integrates JavaScript.
  • <body>: Contains all visible markup elements on the page.

Boilerplate Example

html
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>My Website</title>
</head>
<body>

</body>
</html>

Interview questions

Sign in to save

Is <!DOCTYPE html> an HTML tag?

No, it is a document type declaration (DTD) that instructs the browser to parse the document in standards-compliant mode (HTML5) instead of quirks mode.

Practice

Create a minimal HTML5 boilerplate from memory containing a document title and viewport settings.

Hint: Include the <!DOCTYPE html>, html, head with meta charset, title, and body tags.