Introduction to HTML Basic Structure
HTML, which stands for Hypertext Markup Language, is the standard markup language used to create web pages. At its core, HTML provides a structure and format to the content that is displayed on a web page. In this article, we will discuss the basic structure of an HTML document.
The Declaration
Every HTML document should begin with a declaration, which specifies the version of HTML that the document is written in. The declaration is not an HTML tag, but rather an instruction for the web browser about the version of HTML being used.
The following is an example of an declaration for HTML5:
<!DOCTYPE html>
The Element
The element is the root element of an HTML document. It wraps around all the other elements in the document and represents the entire HTML file. The content of the HTML document is placed between the opening tag and the closing tag.
The Element
The
element is where you can define meta information about the HTML document, such as the title of the page, character encoding, and linked stylesheets or scripts. The content of the element does not appear directly on the web page.The Element
The
An example of the
<title>My Web Page</title>
The Element
The
element represents the content of the web page that will be displayed in the browser. All the visible elements, such as headings, paragraphs, images, links, and other HTML tags, are placed within the element.Example:
<body>
<h1>Hello, World!</h1>
<p>This is my first webpage.</p>
</body>
Document Structure
An HTML document typically has a hierarchical structure. Each HTML element can contain other elements, creating a parent-child relationship. The parent element is the one that wraps around its child elements.
For example, the element is the parent of both the
and elements. The element can then contain multiple child elements, such as headings, paragraphs, and lists.Example:
<html>
<head>
<title>My Web Page</title>
</head>
<body>
<h1>Hello, World!</h1>
<p>This is my first webpage.</p>
</body>
</html>
Conclusion
In this article, we have learned about the basic structure of an HTML document. The declaration defines the HTML version, the element is the root of the document, and the
and elements provide meta and content information respectively. Understanding the structure of an HTML document is essential for building web pages.For further information, you can refer to the following resources: