HTML Page Structure
A basic HTML page structure mainly consists of 4 HTML tags:
<!DOCTYPE html>
: This is the Document Type Declaration that informs the web browser about the type and version of HTML used on a web page.<html> :
A Web page begins & end with HTML tag<head> :
It includes the page title, scripts, styles & meta-information about website<body> :
It will contain the main content of the web page.
Example of HTML Page Structure
<!DOCTYPE html>
<html>
<head>
<title>This is a sample page title</title>
</head>
<body>
<h1>This is a heading.</h1>
<p>This is a sample paragraph content.</p>
</body>
</html>
Document Type Declaration:
A document type declaration (DTD), <!DOCTYPE html>
, is an instruction to the browser about the type of document. The DTD specifies the rules for the markup language so that the browsers render the content correctly. It is always good to add a declaration to your HTML documents for proper standards.
Html
HTML starting tag <html>
indicates the browser that it is an HTML document begins and HTML closing tag </html>
tells the browser that the HTML document is completed.
Header
The header section does not output text inside the browser, it is used to specify information about the web page. It is used to display the page title, scripts, and style for the web page.
Body
This is the main part of the HTML document. The content which we want to display on the browser will be written inside body tags. The HTML body contains different types of content and tags. For example, we have used <h1>
heading and <p>
paragraph tags inside body.
We will read more about the other tags in the next chapters.
Exercises & Assignments |
---|
No Content Found. |
Interview Questions & Answers |
---|
What is !DOCTYPE in HTML? |