
Basic Tags in HTML - Part 2
Understanding HTML Tags and Their Importance
HTML (Hypertext Markup Language) is the foundation of every webpage. It consists of tags that structure content and define how elements appear in a browser. Let’s explore key HTML tags that help in creating well-organised and visually appealing web pages.
Core HTML Tags
Every HTML document has four fundamental tags.
- <html> – Wraps the entire document.
- <head> – Contains metadata like page title and linked stylesheets.
- <title> – Defines the title shown in the browser tab.
- <body> – Holds all visible content.
Basic HTML Structure
<!DOCTYPE html>
<html>
<head>
<title>My Webpage</title>
</head>
<body>
<h1>Welcome!</h1>
<p>This is a simple HTML page.</p>
</body>
</html>
Structuring Content with HTML Tags
Headings (<h1> to <h6>)
Used to define headings and subheadings.
<h1>Main Heading</h1>
<h2>Subheading</h2>
Paragraphs and Line Breaks
The <p> tag defines paragraphs, while <br> adds a line break.
<p>This is a paragraph. </p>
<p>New line starts here. <br>Second line.</p>
Horizontal Rule (<hr>)
Adds a horizontal line to separate sections.
<p>Section One</p>
<hr>
<p>Section Two</p>
Text Formatting Tags
Enhances text appearance.
<p><b>Bold</b>, <i>Italic</i>, and <u>Underlined</u> text. </p>
Lists in HTML
- Unordered List (<ul>) – Displays bullet points.
- Ordered List (<ol>) – Displays numbered items.
Adding Links and Images
Hyperlinks and images improve navigation and visuals.
- Hyperlinks (<a>) – Connects pages.
- Images (<img>) – Enhances visuals.
Comments in HTML
<!-- Comment --> – Adds notes without affecting the page.
Conclusion
HTML tags define webpage structure, making them essential for web development. Mastering these tags helps create well-organised, readable, and interactive web pages.