day #7 : Web development Journey
Today’s topic is “Basic Structure of HTML” ..,
HTML (HyperText Markup Language) is the standard language used to create and design web pages. Every HTML document follows a basic structure that ensures the page is correctly displayed by web browsers. Here's a breakdown of the key components of an HTML document:
1. Document Type Declaration
The <!DOCTYPE>
declaration specifies the version of HTML being used. For modern web pages, the declaration is:
<!DOCTYPE html>
2. HTML Element
The <html>
element is the root of an HTML document. All other elements are nested within it:
<html>
<!-- Content goes here -->
</html>
3. Head Section
The <head>
element contains meta-information about the document, such as its title, character set, linked stylesheets, and more. It does not display directly on the webpage. Example:
<head>
<meta charset="UTF-8">
<title>My First HTML Page</title>
<link rel="stylesheet" href="styles.css">
</head>
Common Tags in the Head Section:
<title>
: Specifies the title displayed in the browser tab.<meta>
: Provides metadata (e.g., character encoding, viewport settings).<link>
: Links external resources like CSS files.<style>
: Embeds internal CSS styles.
4. Body Section
The <body>
element contains all the visible content of the webpage, including text, images, videos, links, and more. Example:
<body>
<h1>Welcome to My Page</h1>
<p>This is a paragraph of text.</p>
</body>
Complete Example:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Basic HTML Structure</title>
</head>
<body>
<h1>Hello, World!</h1>
<p>This is a basic HTML page structure.</p>
</body>
</html>