HTML Document Structure
HTML Document Structure: Basic structure of an HTML document using <!DOCTYPE>, <html>, <head>, and <body> tags.
An HTML (Hypertext Markup Language) document has a basic structure that consists of several key elements, including the <!DOCTYPE>, <html>, <head>, and <body> tags. These elements help define the document's type, structure, and content. Here's a breakdown of their usage:
<!DOCTYPE> Declaration:
The <!DOCTYPE> declaration is not an HTML tag but rather an instruction to the web browser that specifies the version of HTML being used. It helps the browser interpret and display the document correctly. The declaration is placed at the very beginning of the HTML document. Here's an example of a <!DOCTYPE> declaration for HTML5:
html code
<!DOCTYPE html>
<html> Element:
The <html> element is the root element of an HTML document. All other HTML elements are nested within this element. It contains two main sections: <head> and <body>. Here's how you open and close the <html> element:
html code
<html>
<!-- Content goes here -->
</html>
<head> Element:
The <head> element contains metadata about the document, such as the document's title, character encoding, and links to external resources like stylesheets and scripts. It doesn't display content directly on the web page. Here's how you open and close the <head> element:
html code
<head>
<!-- Metadata and external resources go here -->
</head>
<body> Element:
The <body> element contains the main content of the HTML document that will be displayed in the web browser. This is where you include text, images, links, and other visible elements that make up the web page's content. Here's how you open and close the <body> element:
html code
<body>
<!-- Main content goes here -->
</body>
Here's a complete example of a basic HTML document structure:
html code
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Amit Web Page</title>
<!-- Include CSS stylesheets or JavaScript files here -->
</head>
<body>
<h1>Welcome to Amit Web Page</h1>
<p>This is a simple HTML document.</p>
<!-- Other content goes here -->
</body>
</html>
In this example, the <!DOCTYPE> declaration specifies HTML5, and the document structure is organized into the <html>, <head>, and <body> sections. The <head> section contains metadata like the character encoding and page title, while the <body> section contains the visible content of the web page.
Comments
Post a Comment