Have you ever marveled at the intricate WordPress websites you visit and wondered how they’re built? The magic lies in a fundamental language called Hypertext Mark Up Language, the cornerstone of every webpage. Learning HTML is like mastering the alphabet of web development, allowing you to create basic web pages or customize existing ones.
This article equips you with the building blocks of HTML and guides you through creating a simple webpage with examples:
1. Tags:
Imagine your webpage as a blueprint. HTML tags act as instructions for your web browser, dictating how to display the content. These tags are written within angle brackets (<
and >
). For instance, the <p>
tag defines a paragraph, while <h1>
signifies a heading. Every opening tag has a corresponding closing tag (</p>
and </h1>
) to mark the end of the content.
Example:
<h1>Welcome to My Website!</h1>
<p>This is a paragraph containing some introductory text.</p>
Here, the <h1>
tag displays “Welcome to My Website!” as a prominent heading, while the <p>
tag creates a paragraph for the introductory text.
2. Elements:
Everything you see on a webpage, from captivating visuals to informative text, is an HTML element. Each element is constructed using an opening and closing tag, with the content nestled between them. For instance, the text “Hello, World!” becomes a paragraph element when wrapped within <p>Hello, World!</p>
tags.
Example:
<p><b>Bold Text</b> and <i>Italicized Text</i> can be used within paragraphs.</p>
In this example, the <b>
tag makes the text “Bold Text” bold, while the <i>
tag italicizes “Italicized Text”. These tags are nested within the <p>
element, making them part of the paragraph.
3. Attributes:
Think of attributes as specific details you provide for your web browser. They refine the elements by specifying characteristics like size, color, or alignment. For instance, the <img>
tag, used for images, often has a src
attribute that specifies the image location.
Example:
<img src="image.jpg" alt="This is an image description">
Here, the <img>
tag displays an image named “image.jpg”. The alt
attribute provides a text description, crucial for accessibility and search engines.
Building Your First Webpage:
Armed with this basic understanding of tags, elements, and attributes, you can create a simple webpage! Here’s a sample code:
<!DOCTYPE html>
<html>
<head>
<title>My First Webpage</title>
</head>
<body>
<h1>My Website</h1>
<p>This is my first ever webpage. It's exciting to learn HTML!</p>
<img src="websitelogo.png" alt="Website Logo">
</body>
</html>
Save this code as an .html
file (e.g., “mypage.html”) and open it in a web browser to see your creation come alive!
Remember:
- It is a markup language, not a programming language. It structures content, not interactivity.
- There’s a vast array of tags, each with a specific purpose.
- While basic HTML is beginner-friendly, advanced features require further exploration.
Answer these Questions to remember the Html concepts and stay tuned with us for more knowledge :
- How can you make bold text on a webpage using HTML?
- What are the two main parts that make up an HTML element?
- Imagine you want to display a picture on your webpage. What basic HTML tag would you use?
- What kind of file should you save your HTML code in?
- Is HTML a programming language like Python or Java?