Chapter 3: Exploring The Basic HTML Building Blocks
Chapter 3: Exploring Basic HTML Building Blocks
Welcome to Chapter 3 of your HTML learning journey! In this chapter, we'll delve into the core building blocks of HTML. Understanding these
elements is crucial for creating the structure and content of web pages. We'll cover headings, paragraphs, lists, links, and images.
3.1 Headings
Headings are used to define the titles and subtitles of your content, similar to headings in a book. HTML provides six levels of headings,
<h1> to <h6>, with <h1> being the most important (or highest level) and <h6> the least.
<h1>Main Title</h1>
<h2>Subsection</h2>
<h3>Sub-subsection</h3>
<!-- ... up to h6 -->
Best Practice: Use only one <h1> per page, as it typically represents the main topic.
3.2 Paragraphs
The <p> tag defines a paragraph. Browsers automatically add a space before and after each paragraph, making the text more readable.
<p>This is a paragraph of text. Here, you can write content that is separated from other blocks of text.</p>
3.3 Lists
HTML supports ordered (numbered) and unordered (bulleted) lists, which are great for presenting information in a clear, organized way.
Unordered Lists: Use <ul> for lists where the order doesn't matter. Each item in the list is enclosed in <li> (list item) tags.
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
Ordered Lists: Use <ol> for lists where the order is important. The list items are also marked with <li>.
<ol>
<li>First step</li>
<li>Second step</li>
<li>Third step</li>
</ol>
3.4 Links
The <a> tag is used to create hyperlinks, which are essential for navigating between web pages and websites.
<a href="https://www.example.com">Visit Example.com</a>
Attributes:
href: Specifies the URL of the page the link goes to.
target: Specifies how to open the link (e.g., in a new window using target="_blank").
3.5 Images
The <img> tag is used to embed images in an HTML page. This tag is self-closing, meaning it doesn't have an end tag.
<img src="image.jpg" alt="Description of image">
Attributes:
src: Specifies the path to the image.
alt: Provides alternative text for the image if it cannot be displayed. This is also important for accessibility.
Summary
In this chapter, you've learned about the basic building blocks of HTML: headings, paragraphs, lists, links, and images.
These elements form the foundation of your web pages, allowing you to structure content effectively and create interactive and engaging web experiences.
Up Next: In the next chapter, we will explore more advanced HTML elements like tables, forms, and semantic HTML,
which will further enhance the functionality and accessibility of your web pages.
As you continue with your learning, remember to experiment with these elements in your own HTML documents to see how
they work together to create a well-structured web page.