Introduction to HTML Nesting, Tables, and Divs basic tutorial

Tables and divs

What is a div element tag ?

The <div> tag is a block-level container used to group HTML elements together. It is often used to apply styles or organize content in sections.

div con

HTML div tag example

div container
  • The <div> tag allows you to group elements together into one section. It does not have a visual appearance but can be styled with CSS. Commonly used for layout and structure.

Nesting HTML Elements, What is Nesting ?

  • The Nesting means placing one HTML element tag inside another element. This is how most complex HTML structures are built.

An HTML Nested list

Nesting
  • An unordered list is nested inside a <div> element tag and the list is further nested inside the category <h2> heading. Nesting helps create a clear hierarchy and structure for the content.

Introduction to Html Tables

tables

What is a Table ?

  • The html Tables are used to display data in a structured and in grid format. A table consists of rows <tr> tag, and each row contains cells <td> tag. The table can also have header cells <th> tag. Tables refers to arrange the data into the rows and columns.

Simple html table shows a company, contact and country data in organized way and also in a grid format to understand quickly and easily.

Tables
  • The <table> tag creates the table. <tr> tag defines a row, <th> tag defines a header cell, and <td> tag defines a data cell and the border attribute is used to create visible borders for the table cells.

Adding Table Headings and Captions

Tab Headings
  • The <caption> tag is used to add a title to the table and <th> tag is used for header cells, which are bold and centered by default.

Table header and captions visual example for understanding.

Table headings
  • The <caption> tag adds a title to the table, which is typically placed above the table and <th> tag is used for table headings or table header, which make the table easier to read and understand.

Advanced Table Features Merging Cells

Meging

Merging Cells with colspan and rowspan

  • You can merge table cells using the colspan and rowspan attributes. colspan merges columns, and rowspan merges rows.

Merging tables cells that span two columns

Merging cells

Simple Html Employee Table shows a monthly salary data

  • Let’s make a simple table of employees and their monthly salary table data, We have created a table with Three 3 columns and four 4 rows now let’s add some details in the table cells.
NameSalaryDate
Anees Abro15000 Rupees01-02-2025
Kamran Bhutto20000 Rupees01-03-2025
Akram Ali23000 Rupees01-04-2025
Easy and Simple Table data shows the employees salary records with their current amount of salary.

Complete the task which is given below to improve your code practice.

  • Create a product price table that includes at least three columns, Product, Price, and Quantity. Add a caption for the table.
  • Use colspan and rowspan to merge cells where appropriate merge product details like price and warranty into one row.

If you like this tutorial and learned some knowledge share this tutorial with your friends and to the global network. On your social media accounts.

4 thoughts on “Introduction to HTML Nesting, Tables, and Divs basic tutorial”

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top