W3Schools Table Tag Mastery Complete Guide

Logan Jul 13, 2026

Web development is a dynamic field, with a myriad of tools and resources available to help learners gain mastery. One such resource is W3Schools, a platform that offers interactive tutorials and references for various web development topics, including the humble yet powerful <table> tag. In this comprehensive guide, we'll delve into the world of tables in HTML, exploring their syntax, attributes, and real-world use cases, all backed by W3Schools' teachings.

White Name Tag A4 Template
White Name Tag A4 Template

tables.html

<table> is an HTML element that caters to the need for structured tabular data in web pages. It defines a table and its properties, including width, border, and alignment. The <table> tag is a container for <tr> (table row), <th> (table header), and <td> (table data) elements.

the printable worksheet for handwriting and numbers with handprints on it
the printable worksheet for handwriting and numbers with handprints on it

Table Basics

The <table> tag is the starting point for creating tables in HTML. To create a simple table, you'll need at least one <tr> (table row) within the <table> tag. Each <tr> contains <th> (table header) or <td> (table data) elements.

Desk Name Tag Template
Desk Name Tag Template

Example:

Header 1 Header 2
Data 1 Data 2
two name tags with crayons on them for kids to write their name in
two name tags with crayons on them for kids to write their name in

Table Borders and Alignment

The <table> tag has an attribute, border, that specifies whether the table has borders or not. The default value is 1, but setting border="0" will remove the table borders.

Another attribute, align, can be used to specify the horizontal alignment of a table. Accepted values are 'left', 'right', and 'center'.

Editable School Name Tags Bundle | Canva Editable
Editable School Name Tags Bundle | Canva Editable

Table Width and Height

The width and height attributes specify the width and height of the table in pixels. Alternatively, you can use the style attribute to set the dimensions using CSS styles.

Example:

Free Printable Name Tags For Desks [PDF] - Printables Hub
Free Printable Name Tags For Desks [PDF] - Printables Hub
Header 1 Header 2
Data 1 Data 2

Table Headers and Data

an orange cup filled with pencils sitting on top of a desk next to a sign that says giana
an orange cup filled with pencils sitting on top of a desk next to a sign that says giana
Kerry Antilla
Kerry Antilla
I LOVE TEACHING IDEAS
I LOVE TEACHING IDEAS
Ultimate 2000's Editable Desk Name Tags | Retro Classroom Name Plates
Ultimate 2000's Editable Desk Name Tags | Retro Classroom Name Plates
Math desk name plates desk name tags back to school freebie
Math desk name plates desk name tags back to school freebie
35K views · 186 reactions | Group Table Tour… Comment “TABLE” for links🥰❤️🎥Credit to : thetidyclassroom on IG 🍎Follow Amz Rockstar Teachers for teaching inspiration, helpful ideas, and a community of te | Amz  Rockstar Teachers
35K views · 186 reactions | Group Table Tour… Comment “TABLE” for links🥰❤️🎥Credit to : thetidyclassroom on IG 🍎Follow Amz Rockstar Teachers for teaching inspiration, helpful ideas, and a community of te | Amz Rockstar Teachers
Desk Name Plates Editable - Student Desk Name Tags - 2nd and 3rd Grade
Desk Name Plates Editable - Student Desk Name Tags - 2nd and 3rd Grade
two pencils and some writing paper with different colored crayons on the top
two pencils and some writing paper with different colored crayons on the top
Nameplate Display Trays
Nameplate Display Trays
Ceiba Tree 36 Desk Name Tags
Ceiba Tree 36 Desk Name Tags
two pink and white printable alphabets with numbers, symbols and letters on them
two pink and white printable alphabets with numbers, symbols and letters on them
16 Inventive Desk Name Plate Ideas for Teachers
16 Inventive Desk Name Plate Ideas for Teachers
Editable Desk Name Tags for Students
Editable Desk Name Tags for Students
Insects Desk Name Tags
Insects Desk Name Tags
The Best Way to Attach Name Tags to Student Desks
The Best Way to Attach Name Tags to Student Desks
7.5" Classroom Name Plates, 24ct. by B2C™ in Rainbow Check | Michaels®
7.5" Classroom Name Plates, 24ct. by B2C™ in Rainbow Check | Michaels®
Zoo animal theme classroom name tags, labels and signs | classroomHQ
Zoo animal theme classroom name tags, labels and signs | classroomHQ
Printable Classic Black and White Editable Classroom Name Plates | Simply Sweet
Printable Classic Black and White Editable Classroom Name Plates | Simply Sweet
Printable Bright Classroom Table Numbers, Table, Team and Group Numbers, Back to School Vibrant Star Classroom Table Signs, Table Posters
Printable Bright Classroom Table Numbers, Table, Team and Group Numbers, Back to School Vibrant Star Classroom Table Signs, Table Posters
Editable Foldable Student Desk Name Tags
Editable Foldable Student Desk Name Tags

The <th> element defines table headers, and the <td> element represents the data in a table.

Table Headers

The <th> element is used to group table headers together. Text within <th> elements is automatically bold and centered. Headers can also be spanned across rows or columns using the rowspan and colspan attributes.

Table Data

The <td> element defines the data in a table. The data can be text, images, links, or any other HTML elements.

You can use the colspan and rowspan attributes to span a cell across multiple columns or rows, respectively.

Cell Spanning and Grouping

The colspan attribute specifies the number of columns a cell should span. The rowspan attribute, on the other hand, specifies the number of rows a cell should span.

Example:

Header 1 Header 2
Data 1 Data 2
Data 3

W3Schools provides interactive examples and tutorials on each of these topics, making it easier to understand and apply these concepts. Whether you're a beginner or an experienced web developer, W3Schools offers a wealth of resources to enhance your understanding of tables in HTML.

the W3Schools table tag reference is a comprehensive guide that succinctly explains the <table> tag, its attributes, and usage. With practice and exploration, you'll be well on your way to creating engaging and efficient web tables.