Day 2: HTML Tags



HTML : Hyper Text Markup Language

HTML stands for HyperText Markup Language. It is the standard language used to build and structure the content of a webpage.

  • HyperText: The power to create links that connect one webpage to another, forming the “web” of information.
  • Markup Language: Uses tags to “mark up” plain text, giving it structure and meaning (like headings, paragraphs, or links).

Fun fact: The very first website ever created is still online here: First Website




Install Required Software

  1. Install Visual Studio Code

    Visual Studio Code (VS Code) is a free code editor from Microsoft that you will use to write and organize your code.

    Download here: Visual Studio Code

  2. Install VS Code Extensions

    Extensions add extra features to VS Code. The most useful ones for web development are:

    • Live Server: Instantly preview your website in a browser and auto-refresh on save.
    • Prettier: Automatically formats your code to keep it clean and consistent.



1. The Heading (<h1> to <h6>)

Headings are HTML tags used to define titles and subtitles on a webpage. They create a logical hierarchy, helping both humans and machines (like search engines or screen readers) understand the structure of your content.

            <h1>Main Heading</h1>
<h2>Section Heading</h2>
<h3>Sub-section Heading</h3>
<h4>Smaller Heading</h4>
<h5>Even Smaller</h5>
<h6>Tiniest Heading</h6>

<h1> → The most important heading, usually used once per page as the main title.
<h2> → Major section heading.
<h3> → Sub-section under.
<h4> → Sub-section under.
<h5> → Less important heading.
<h6> → The least important, often used rarely.

🔹Why it matters:




2. The Paragraph (<p>)

The paragraph tag defines blocks of text. It’s the most common tag for writing content.

            <p>This is the first paragraph. It contains sentences about a topic.</p>
<p>This is the second paragraph. The browser will display it with spacing above and below.</p>

🔹Why it matters:




3. Horizontal Rules (<hr>)

The <hr> tag is used to create a horizontal line (rule) across the page. It represents a thematic break or a change in topic within your content




4. The Line Break (<br>)

The <br> tag forces the text to break and continue on the next line, without starting a new paragraph.




5. List Elements (<ul>, <ol>, <li>)

Lists are a way to organize related information in a clean, structured format.

HTML gives us special tags to create lists, and this is also where nesting comes into play — putting one tag inside another.

🔹The Tag:

🔹The Purpose:

🔹Example 1: Unordered List (Shopping List)

            <ul>
                <li>Tea Bag</li>
                <li>Water</li>
                <li>Sugar</li>
                <li>Milk</li>
            </ul>
        

Results:

🔹Example 2: Ordered List (Steps to Make Tea)

            <ol>
                <li>First, boil the water in a kettle.</li>
                <li>Add tea bag, sugar and milk into it.</li>
                <li>Keep boiling it for 5 minutes.</li>
                <li>Serve the tea by pouring it into a cup.</li>
            </ol>
        

Results:

  1. First, boil the water in a kettle.
  2. Add tea bag, sugar and milk into it.
  3. Keep boiling it for 5 minutes.
  4. Serve the tea by pouring it into a cup.



6. The Anchor Tag (<a>)

The anchor tag is what makes the web “hypertext.” It lets you create clickable links to another webpage, a file, an email address, or even a specific spot within the same page.

🔹The Tag: <a>

🔹The Purpose:

🔹Example: Simple Link

            <a href="https://www.coderarmy.in/">Visit Coder Army</a>
        

🔹Result:

Visit Coder Army

🔹HTML Links - The target Attribute

By default, links open in the same browser tab (_self).

But we can control where the link opens using the target attribute:




7. The Image Tag (img)

The img tag is a self-closing tag used to embed images in a webpage.

🔹Purpose:

To display pictures, icons, or any visual content on a page.

🔹Important Attributes:

🔹Example:

            <img src="https://cdn.britannica.com/16/234216-050-C66F8665/beagle-hound-dog.jpg" 
            height="300px" 
            width="300px" 
            alt="This is a Dog Photo">
        

🔹Result:

This is a Dog Photo