Basic Tags in HTML
In this lesson, we will learn about some of the most fundamental HTML tags, which form the structure and format of any web page. These tags include <html>, <head>, <title>, <body>, <h1> to <h6>, and <p>.
Structural Tags
- <html>: This is the root element that encloses the entire HTML document.
- <head>: Contains metadata about the document, such as its title and links to stylesheets.
- <title>: Defines the title of the webpage, which is displayed in the browser's title bar or tab.
- <body>: Contains the visible content of the webpage, such as text, images, and links.
<html> <head> <title>My First Web Page</title> </head> <body> Content goes here... </body> </html>
Formatting Tags
HTML also includes tags to format content. Here, we’ll explore <h1> to <h6> and <p>:
<h1> to <h6>: Headings
These tags are used to create headings. <h1> is the largest and most important heading, while <h6> is the smallest.
<h1>This is a Heading 1</h1> <h2>This is a Heading 2</h2> ... <h6>This is a Heading 6</h6>
<p>: Paragraphs
The <p> tag is used to define paragraphs. It helps structure text content into readable blocks.
<p>This is a paragraph of text.</p>
Example
Here’s an example of using these basic tags:
<html> <head> <title>Example Page</title> </head> <body> <h1>Welcome to My Page</h1> <p>This is a paragraph explaining the purpose of this page.</p> <h2>Subheading</h2> <p>Another paragraph with more details.</p> </body> </html>
Written By: Muhammad Shoaib Khan Marwat (MSKM) | https://codebacha.blogspot.com/