Coding Schools


 
Python | C Sharp | Azure AI | HTML | JavaScript | CSS | SQL Server
Basic Structure of HTML
HTML 5 Features
IFrame in HTML
HTML - div and span tags
HTML - marquee element
HTML - List elements
HTML - paragraph element
HTML - table elements

Basic Structure of HTML



The basic structure of an HTML document is crucial for creating well-formed web pages. Here' an overview of the fundamental components:

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>
</head>
<body>
    <!-- Your content goes here -->
</body>
</html>

Explanation of Each Component

  1. <!DOCTYPE html>: This declaration defines the document type and version of HTML5. It ensures that the browser renders the page correctly.

  2. <html lang="en">: The <html> element is the root element of an HTML document. The lang attribute specifies the language of the document.

  3. <head>: The <head> element contains meta-information about the document, such as the character set, title, and links to stylesheets or scripts.

    • <meta charset="UTF-8">: This element specifies the character encoding for the document, ensuring that the text is displayed correctly.

    • <meta name="viewport" content="width=device-width, initial-scale=1.0">: This meta tag helps with responsive web design, making sure the page is scaled correctly on different devices.

    • <title>Your Page Title</title>: The title element sets the title of the web page, which appears in the browser's title bar or tab.

  4. <body>: The <body> element contains the content of the HTML document, such as text, images, links, and other elements.

Example with Content

html
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>My First Web Page</title>
</head>
<body>
    <h1>Welcome to My Web Page</h1>
    <p>This is a simple example of an HTML document.</p>
</body>
</html>

This structure ensures that your HTML documents are well-organized and understood by web browsers, promoting good practices in web development. If you want to dive deeper into HTML elements or have any specific questions, feel free to ask!




All rights reserved | Privacy Policy | Sitemap