Introduction to HTML Nesting, Tables, and Divs basic tutorial

Tables and divs

What is a <div> ?

  • 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.

Explanation

  • 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?

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

Explanation

  • In this example, an unordered list is nested inside a <div> The list is further nested inside the category <h2> heading.
  • Nesting helps create a clear hierarchy and structure for the content.

Introduction to Tables

What is a Table?

  • Tables are used to display data in a structured, grid format.
  • A table consists of rows (<tr>), and each row contains cells (<td>). The table can also have header cells (<th>).
  • The <table> tag creates the table.
  • <tr> defines a row, <th> defines a header cell, and <td> defines a data cell.
  • The border=”1″ attribute is used to create visible borders for the table cells.

Adding Table Headings and Captions

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

Explanation

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

Advanced Table Features Merging Cells

Merging Cells with colspan and rowspan

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

Explanation

  • colspan=”2″ merges two columns into one.
  • rowspan=”2″ merges two rows into one.

Tutorial Completed, If you want to learn different tutorials click here.

1 thought 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