Skip to main content

Python type() Function

When learning Python, you will work with different types of data, such as numbers, text, decimal values, and Boolean values. Python provides several built-in functions to help you work with these data types. One of the most useful functions is the type() function . The type() function tells you the data type of a value or variable. It helps you understand what kind of data Python is working with and can make debugging your programs easier. For example, consider these variables: age = 20 price = 99.50 name = "Rahul" is_student = True Although all four variables store data, their data types are different. Python allows us to check these types using type() . Let's understand how it works with simple examples. 1. What Is the type() Function in Python? The type() function is a built-in Python function that returns information about the type of an object. In beginner-level programming, you can use it to check whether a value is an integer, a floating-point number, a string,...

HTML Semantic Tags – Building Meaningful Webpages

As websites became more complex, developers needed a better way to organize webpage content. Earlier, most webpages were built using generic tags like <div> and <span>, which provided little information about the purpose of the content.

HTML5 introduced Semantic Tags to solve this problem.

Semantic tags make webpages:

  • Easier to understand

  • Better organized

  • SEO-friendly

  • More accessible

In this article, we will learn:

  • What semantic tags are

  • Why semantic tags are important

  • Common HTML5 semantic elements

  • Page layout structure

  • SEO benefits

  • Accessibility advantages

  • Practical examples


What are Semantic Tags?

A semantic tag clearly describes the meaning of its content.

The word semantic means "related to meaning."

For example:

<header>
    Welcome to My Website
</header>

The browser and developer immediately understand that this content belongs to the header section.


Non-Semantic vs Semantic Tags

Non-Semantic Tags

<div>
    Welcome to My Website
</div>

The <div> tag provides no information about its purpose.


Semantic Tags

<header>
    Welcome to My Website
</header>

The <header> tag clearly indicates that the content belongs to the page header.


Why Semantic Tags are Important

Semantic tags help:

  • Improve webpage structure

  • Increase readability

  • Improve SEO

  • Improve accessibility

  • Help search engines understand content

  • Simplify website maintenance

Search engines like Google analyze semantic structures to better understand webpages.


Common HTML5 Semantic Tags

TagPurpose
<header>Header section
<nav>Navigation links
<section>Content section
<article>Independent content
<aside>Sidebar content
<main>Main content
<footer>Footer section
<figure>Image container
<figcaption>Image caption

Basic Semantic Layout

----------------------------------
|           HEADER              |
----------------------------------
| NAVIGATION MENU               |
----------------------------------
| MAIN CONTENT                  |
|                               |
|  ARTICLE      SIDEBAR         |
|                               |
----------------------------------
|           FOOTER              |
----------------------------------

The <header> Tag

The <header> tag represents introductory content.

It often contains:

  • Website logo

  • Website title

  • Navigation links

  • Search bar


Example

<header>

    <h1>My Blog</h1>

</header>

Practical Example

<header>

    <h1>Learn HTML</h1>

    <p>Complete HTML Tutorial</p>

</header>

The <nav> Tag

The <nav> tag contains navigation links.


Example

<nav>

    <a href="index.html">Home</a>

    <a href="about.html">About</a>

    <a href="contact.html">Contact</a>

</nav>

Why Use <nav>?

Browsers and search engines understand that these links are part of website navigation.


The <main> Tag

The <main> tag contains the primary content of the webpage.

A webpage should normally contain only one <main> element.


Example

<main>

    <h2>Welcome</h2>

    <p>This is the main content.</p>

</main>

The <section> Tag

The <section> tag groups related content.

Think of sections as chapters in a book.


Example

<section>

    <h2>Introduction</h2>

    <p>HTML is a markup language.</p>

</section>

Multiple Sections Example

<section>

    <h2>HTML</h2>

    <p>Structure of webpages.</p>

</section>

<section>

    <h2>CSS</h2>

    <p>Styling webpages.</p>

</section>

The <article> Tag

An article represents independent content.

Examples:

  • Blog posts

  • News articles

  • Product reviews

  • Forum posts


Example

<article>

    <h2>Introduction to HTML</h2>

    <p>HTML is the foundation of web development.</p>

</article>

Why Use <article>?

Content inside an article can stand alone independently.


The <aside> Tag

The <aside> tag contains secondary content.

Examples:

  • Advertisements

  • Related posts

  • Sidebars

  • Author information


Example

<aside>

    <h3>Related Articles</h3>

    <ul>

        <li>HTML Basics</li>

        <li>CSS Fundamentals</li>

    </ul>

</aside>

The <footer> Tag

The footer appears at the bottom of a webpage.

Common footer content:

  • Copyright notice

  • Contact information

  • Social media links

  • Privacy policy


Example

<footer>

    Copyright 2026

</footer>

Practical Footer Example

<footer>

    <p>Email: info@example.com</p>

    <p>Copyright © 2026</p>

</footer>

The <figure> Tag

The <figure> tag contains images, diagrams, or illustrations.


Example

<figure>

    <img src="mountain.jpg">

</figure>

The <figcaption> Tag

Used to provide captions for figures.


Example

<figure>

    <img src="mountain.jpg">

    <figcaption>
        Beautiful Mountain
    </figcaption>

</figure>

Complete Semantic Webpage Example

<!DOCTYPE html>
<html>

<head>

    <title>Semantic HTML</title>

</head>

<body>

<header>

    <h1>My Website</h1>

</header>

<nav>

    <a href="#">Home</a>

    <a href="#">About</a>

    <a href="#">Contact</a>

</nav>

<main>

    <section>

        <h2>HTML Tutorial</h2>

        <p>Learn HTML step by step.</p>

    </section>

    <article>

        <h2>Latest Post</h2>

        <p>HTML5 introduced semantic tags.</p>

    </article>

    <aside>

        <h3>Related Topics</h3>

        <ul>

            <li>CSS</li>

            <li>JavaScript</li>

        </ul>

    </aside>

</main>

<footer>

    <p>Copyright © 2026</p>

</footer>

</body>

</html>

Output Structure

----------------------------------
My Website
----------------------------------

Home  About  Contact

----------------------------------

HTML Tutorial

Learn HTML step by step.

----------------------------------

Latest Post

HTML5 introduced semantic tags.

----------------------------------

Related Topics

• CSS
• JavaScript

----------------------------------

Copyright © 2026
----------------------------------

Semantic Tags and SEO

SEO stands for Search Engine Optimization.

Semantic tags help search engines understand:

  • Main content

  • Navigation menus

  • Articles

  • Sidebars

  • Footers

This improves indexing and search visibility.


Semantic Tags and Accessibility

Accessibility helps users with disabilities.

Screen readers can easily identify:

  • Headers

  • Navigation menus

  • Articles

  • Footers

This improves user experience.


Semantic vs Non-Semantic Layout

Old Style

<div class="header"></div>

<div class="menu"></div>

<div class="content"></div>

<div class="footer"></div>

Modern Style

<header></header>

<nav></nav>

<main></main>

<footer></footer>

Modern semantic code is easier to understand.


Advantages of Semantic HTML

  • Better organization

  • Improved SEO

  • Better accessibility

  • Easier maintenance

  • Cleaner code

  • Professional development standards


Common Mistakes Beginners Make

1. Using Only <div> Tags

Wrong:

<div>Header</div>

Better:

<header>Header</header>

2. Using Multiple <main> Elements

Usually only one main content area should exist.


3. Putting Unrelated Content in Articles

Articles should contain independent content.


Real-Life Usage

Modern websites such as Wikipedia, YouTube, and Amazon use semantic HTML structures to improve organization, SEO, and accessibility.


Conclusion

Semantic HTML is one of the most important features introduced in HTML5. It provides meaning to webpage content, making websites easier for developers, browsers, search engines, and users to understand.

Comments

Popular posts from this blog

Understanding Comments in Java: A Beginner’s Guide

When learning Java programming, one of the first concepts you’ll come across is comments . Comments may not affect how a program runs, but they play a crucial role in making code more understandable, readable, and maintainable. Let’s dive deeper into what comments are, why they’re important, and the different types of comments in Java. What are Comments in Java? A comment in Java is a piece of text written within a program that is ignored by the compiler . In other words, comments are notes for humans, not instructions for machines. They help developers explain the purpose of code, describe logic, or temporarily disable certain lines of code without deleting them. Why are Comments Important? ๐Ÿ“Œ Readability – Comments make code easier to understand for you and others. ๐Ÿ“Œ Maintenance – When you revisit your code after months, comments remind you what you were doing. ๐Ÿ“Œ Collaboration – In team projects, comments explain code to fellow developers. ๐Ÿ“Œ Debugging – You c...

Java Program to Check Voting Eligibility

In this program, we’ll take the user’s age as input and check whether the person is eligible to vote or not. In India, the minimum age required to vote is 18 years . ๐Ÿ’ป Program Code // Java Program to Check Voting Eligibility import java.util.Scanner; public class VotingEligibility { public static void main(String[] args) { // Create Scanner object to take input from user Scanner sc = new Scanner(System.in); // Ask user to enter age System.out.print("Enter your age: "); int age = sc.nextInt(); // Check eligibility if (age >= 18) { System.out.println("You are eligible to vote."); } else { System.out.println("You are not eligible to vote yet."); System.out.println("You can vote after " + (18 - age) + " year(s)."); } sc.close(); // Close the scanner } } ๐Ÿง  Explanation import java.util.Scanner; → Imp...

Java Program to Calculate Total Marks and Average of Five Subjects

๐Ÿ’ก Program Explanation In this program: The user will input marks of five subjects . The program will calculate the total marks and average . It will then display both results clearly. ๐Ÿง‘‍๐Ÿ’ป Java Code: // Java Program to Calculate Total Marks and Average of Five Subjects import java.util.Scanner; // Importing Scanner class for user input public class TotalAndAverage { public static void main(String[] args) { // Creating Scanner object to take input from user Scanner sc = new Scanner(System.in); // Declaring variables for five subjects double subject1, subject2, subject3, subject4, subject5; // Taking marks input for each subject System.out.print("Enter marks of Subject 1: "); subject1 = sc.nextDouble(); System.out.print("Enter marks of Subject 2: "); subject2 = sc.nextDouble(); System.out.print("Enter marks of Subject 3: "); subject3 = sc.nextDo...