Understanding HTML Structure Basics

27 May 2023 Balmiki Mandal 0 Html

HTML Structure Basics

HTML, or HyperText Markup Language, is the standard markup language for creating web pages and web applications. It provides a set of rules for defining the structure and content of a web page, using elements and attributes to specify how text and other content should be displayed.

The basic structure of an HTML document consists of two main parts: the DOCTYPE declaration and the HTML element.

DOCTYPE Declaration

The DOCTYPE declaration specifies the document type, which tells the browser how to interpret the HTML code. It is the first line of an HTML document and is written as follows:

HTML
<!DOCTYPE html>

HTML Element

The HTML element encloses the entire contents of an HTML document, including the head and body sections. It is written as follows:

HTML
<html>
    <head>
        <meta charset="UTF-8">
        <title>My Web Page</title>
    </head>

    <body>
        <h1>Welcome to My Web Page</h1>
        <p>This is a paragraph of text.</p>
    </body>
</html>

Head Section

The head section contains meta information about the HTML page, such as the character encoding, page title, and links to external resources like CSS stylesheets. It is enclosed by the <head> and </head> tags.

Body Section

The body section contains the visible content of the HTML page, such as headings, paragraphs, images, and links. It is enclosed by the <body> and </body> tags.

HTML Elements and Attributes

HTML elements are defined by start and end tags, with the content of the element placed between the tags. Some elements also have attributes, which provide additional information about the element. For example:

HTML
<p>This is a paragraph of text.</p>

This code defines a paragraph element (<p>) with the content "This is a paragraph of text."

Attributes are specified within the start tag, using the format attribute="value". For example:

HTML
<a href="https://www.example.com">Click here</a>

This code defines an anchor element (<a>) with the content "Click here" and the attribute href set to "https://www.example.com". When clicked, the anchor will link to the specified URL.

HTML provides a variety of elements for defining different types of content and structuring a web page. Common elements include headings (<h1>, <h2>, <h3>, etc.), paragraphs (<p>), images (<img>), links (<a>), and lists (<ul>, <ol>, <li>).

By using HTML elements and attributes, web developers can create web pages with a clear and organized structure, making them accessible and user-friendly.

This HTML document will create a web page with a title of "This is my page". The page will have a heading that says "This is my heading" and a paragraph that says "This is my paragraph". The page will also have an image that is displayed.

HTML is a powerful language that can be used to create a wide variety of web pages. By understanding the basic structure of an HTML document, you can start creating your own web pages.

 

Electro4U is a website dedicated to providing the latest tech reviews and news.

We cover topics ranging from the newest gadgets, the hottest trends in technology, reviews of the latest apps, and A.I. advancements. Our goal is to help you stay ahead of the curve and make the most informed decisions about your technology investment.

At Electro4U, we’re committed to delivering quality content that is both entertaining and informative. We strive to provide our readers with a comprehensive overview of the latest and greatest developments in the tech world.

Whether you are an experienced tech enthusiast or just getting started, Electro4U has something for everyone. Visit us now to stay up to date on the newest tech gadgets and trends!

BY: Balmiki Mandal

Related Blogs

Post Comments.

Login to Post a Comment

No comments yet, Be the first to comment.