HTML Document Basic Structure:
An HTML (Hypertext Markup Language) document follows a basic structure that includes the declaration, head, and body sections.
Here's an example of the basic structure of an HTML document:
html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Your Page Title</title>
<!-- Additional head elements such as stylesheets and scripts can be added here -->
</head>
<body>
<!-- The content of your webpage goes here -->
<h1>Hello, World!</h1>
<p>This is a basic HTML document.</p>
</body>
</html>
HTML Document Basic Structure |
Let's break down the structure:
1. `<!DOCTYPE html>`:
- Declares the document type and version of HTML being used. In this case, it's HTML5.
2. `<html>`:
- The root element that wraps the entire HTML document.
3. `lang="en"`:
- Specifies the language of the document. In this example, it's set to English.
4. `<head>`:
- Contains meta-information about the HTML document, such as character set, viewport settings, and the title.
5. `<meta charset="UTF-8">`:
- Specifies the character encoding for the document. UTF-8 is widely used and supports various characters.
HTML Web Page Basic Structure
|
6. `<meta name="viewport" content="width=device-width, initial-scale=1.0">`:
- Sets the viewport settings for responsive design, ensuring the webpage adapts to different device screen sizes.
7. `<title>`:
- Defines the title of the HTML document, which appears in the browser tab or window.
8. `<body>`:
- Contains the content of the HTML document, such as text, images, links, and other elements.
This is a basic template, and you can add more elements, such as headings (`<h1>`, `<h2>`), paragraphs (`<p>`), images (`<img>`), links (`<a>`), and various other HTML elements within the `<body>` to create your webpage's content. Additionally, you can include external stylesheets and scripts in the `<head>` section for styling and interactivity.