Introduction
HTML (HyperText Markup Language) is the backbone of web development. It provides the structure for web pages and allows developers to organize and display content effectively. Whether you’re a beginner stepping into the world of coding or someone looking to refresh their knowledge, understanding HTML is the first step towards creating stunning websites.
In this guide, we’ll cover:
✅ What HTML is
✅ Basic structure of an HTML document
✅ Essential HTML tags
✅ Formatting and styling text
✅ Adding images, links, and lists
✅ Forms and tables
By the end, you’ll be able to write and understand basic HTML code!
1. What is HTML?
HTML is a markup language that structures content on the web. Unlike programming languages like JavaScript or Python, HTML doesn’t have logic or calculations—it simply defines the arrangement of elements like headings, paragraphs, images, and links on a webpage.
👉 HTML files have the extension .html and are read by web browsers to display content properly.
2. Basic Structure of an HTML Document
Every HTML document follows a standard structure. Here’s the simplest version of an HTML page:
Explanation of the Code:
<!DOCTYPE html>
→ Defines the document type as HTML5.<html>
→ The root element that contains all HTML content.<head>
→ Contains meta information like title, character encoding, and viewport settings.<title>
→ Sets the title of the webpage (appears on the browser tab).<body>
→ Contains the visible content of the webpage.
3. Essential HTML Tags
Tag | Description |
---|---|
<h1> to <h6> | Headings (h1 is the largest, h6 is the smallest). |
<p> | Paragraph tag for text content. |
<br> | Line break (creates a new line). |
<hr> | Horizontal rule (adds a dividing line). |
<strong> | Bold text. |
<em> | Italic text. |
<a href="URL"> | Hyperlink to another page. |
<img src="image.jpg" alt="Image description"> | Displays an image. |
<ul> and <ol> | Unordered and ordered lists. |
<li> | List item inside <ul> or <ol> . |
4. Formatting and Styling Text
You can format text using the following HTML tags:
🔹 Bold: <strong>
→ Bold Text
🔹 Italic: <em>
→ Italic Text
🔹 Underline: <u>
→ <u>Underlined Text</u>
5. Adding Images and Links
Adding an Image
- The
src
attribute specifies the image source (URL or file path). - The
alt
attribute provides alternative text for accessibility. - The
width
attribute controls the image size.
Adding a Link
- The
href
attribute specifies the destination URL.
6. Creating Lists
HTML supports unordered (bulleted) lists and ordered (numbered) lists.
Unordered List (Bullets)
🔹 Output:
- Apples
- Bananas
- Cherries
Ordered List (Numbers)
🔹 Output:
- Wake up
- Brush teeth
- Go to work
7. HTML Tables
Tables organize data in rows and columns.
🔹 Explanation:
<table>
→ Creates a table.<tr>
→ Table row.<th>
→ Table header.<td>
→ Table data cell.
Output:
Name | Age |
---|---|
Alice | 25 |
Bob | 30 |
8. Forms in HTML
Forms allow users to enter data, such as login credentials or feedback.
🔹 Explanation:
<form>
→ Defines a form that sends data tosubmit.php
.<label>
→ Provides labels for input fields.<input>
→ Defines input fields (text, email, etc.).<submit>
→ Adds a submit button.
Conclusion
HTML is the foundation of web development, allowing you to structure webpages efficiently. By understanding basic tags, text formatting, images, links, lists, tables, and forms, you can create your first website with ease!
🚀 Next Steps:
- Learn CSS to style your webpage.
- Explore JavaScript for interactivity.
- Practice by building small projects like a portfolio website or a blog page.
👉 Stay tuned for our next guide on CSS Styling Basics! 🎨✨
Comments
Post a Comment