Skip to main content

HTML Basics: A Beginner’s Guide to Web Development

 

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:


<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>My First Webpage</title> </head> <body> <h1>Welcome to My Website</h1> <p>This is my first webpage using HTML!</p> </body> </html>

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

TagDescription
<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:

<p>This is a <strong>bold</strong> and <em>italic</em> text.</p> <p>This is a <u>underlined</u> text.</p>

🔹 Bold: <strong>Bold Text
🔹 Italic: <em>Italic Text
🔹 Underline: <u> → <u>Underlined Text</u>


5. Adding Images and Links

Adding an Image

<img src="image.jpg" alt="Description of Image" width="300">
  • 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

<a href="https://www.google.com">Visit Google</a>
  • The href attribute specifies the destination URL.

6. Creating Lists

HTML supports unordered (bulleted) lists and ordered (numbered) lists.

Unordered List (Bullets)

<ul> <li>Apples</li> <li>Bananas</li> <li>Cherries</li> </ul>

🔹 Output:

  • Apples
  • Bananas
  • Cherries

Ordered List (Numbers)

<ol> <li>Wake up</li> <li>Brush teeth</li> <li>Go to work</li> </ol>

🔹 Output:

  1. Wake up
  2. Brush teeth
  3. Go to work

7. HTML Tables

Tables organize data in rows and columns.

<table border="1"> <tr> <th>Name</th> <th>Age</th> </tr> <tr> <td>Alice</td> <td>25</td> </tr> <tr> <td>Bob</td> <td>30</td> </tr> </table>

🔹 Explanation:

  • <table> → Creates a table.
  • <tr> → Table row.
  • <th> → Table header.
  • <td> → Table data cell.

Output:

NameAge
Alice25
Bob30

8. Forms in HTML

Forms allow users to enter data, such as login credentials or feedback.

<form action="submit.php" method="POST"> <label for="name">Name:</label> <input type="text" id="name" name="name"><br><br> <label for="email">Email:</label> <input type="email" id="email" name="email"><br><br> <input type="submit" value="Submit"> </form>

🔹 Explanation:

  • <form> → Defines a form that sends data to submit.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

Popular posts from this blog

Web Application Development with Jitendra .....

AI and ML Cryptography and Network Security Data structure and Algorithm IntroToOOP Normalization in DBMS OOPS java osi-tcp SSL-TLS protocol