Sitemap
Pravin M

Pravin M

I am a frontend developer with 10+ years of experience Blog :- https://www.frontendinterviewquestions.com

Member-only story

Basic structure of HTML document

3 min readAug 28, 2024

--

Press enter or click to view image in full size
Basic structure of HTML document
Basic structure of HTML document

For more questions and answers visit our website at Frontend Interview Questions

Basic Components of an HTML Document

An HTML document consists of several key components that work together to define the content and layout of a webpage. Here’s a breakdown of these components:

  1. Document Type Declaration (<!DOCTYPE html>)
  2. Root Element (<html>)
  3. Head Section (<head>)
  4. Body Section (<body>

1. Document Type Declaration

Purpose: The <!DOCTYPE html> declaration defines the document type and version of HTML being used. It helps the browser understand how to render the document correctly. For HTML5, this declaration is straightforward and does not include a version number.

Example:

<!DOCTYPE html>

Explanation: This declaration indicates that the document is an HTML5 document.

2. Root Element (<html>)

Purpose: The <html> element is the root of an HTML document. It contains all other elements and encapsulates the entire webpage.

Example:

<html>
<!-- Head and Body sections go here -->…

--

--

Pravin M
Pravin M

Written by Pravin M

I am a frontend developer with 10+ years of experience Blog :- https://www.frontendinterviewquestions.com