HTML (HyperText Markup Language) is the standard language used to create web pages. It provides the structure and defines the elements that make up a webpage. In this article, we will explore the basic structure and syntax of an HTML document.
To create an HTML document, we start with the <!DOCTYPE html>
declaration, which tells the browser that this is an HTML5 document. This is followed by the <html>
element, which serves as the root element of the document.
Inside the <html>
element, we have two main sections: the <head>
and the <body>
. The <head>
section contains meta information about the document, such as the page title and links to external stylesheets or scripts. The <body>
section, on the other hand, contains the actual content of the webpage.
Within the <body>
section, we can use various HTML tags to structure our content. For example, we can use the <h1>
to <h6>
tags for headings, <p>
tags for paragraphs, <ul>
and <ol>
tags for unordered and ordered lists respectively, and <a>
tags for links.
<!DOCTYPE html>
<html>
<head>
<title>My Webpage</title>
</head>
<body>
<h1>Welcome to My Webpage</h1>
<p>This is a paragraph of text.</p>
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
<a href="https://example.com">Click here</a> to visit example.com.
</body>
</html>
Understanding the structure and syntax of HTML is essential in web development as it forms the foundation of any webpage. With this knowledge, you will be able to create well-structured and valid HTML documents.
Keep up the great work, and happy coding!