When a Table Is the Right Choice
Quick answer A table organises data into rows and columns so values can be compared. Use it only for genuinely tabular information, not for arranging a page.
HTML stands for HyperText Markup Language, the language used to describe the structure of a web page. A table is the HTML structure that arranges information in rows (going across) and columns (going down). The box where a row and a column meet is called a cell, and a cell is the smallest unit of a table — every piece of data you display sits inside one.
Before you write a single tag, ask one question: is this data naturally tabular? Data is tabular when each row describes one record and each column describes one property that every record shares. If that is true, a reader can do two useful things: read across a row to see one complete record, and read down a column to compare the same property for many records. If neither reading makes sense, the data is not tabular and a table is the wrong tool.
Good candidates from everyday Indian school and web use include a class timetable (rows are periods, columns are days), a marks sheet (rows are students, columns are subjects), a fee structure in rupees (rows are classes, columns are terms), a train departure list on the IRCTC — Indian Railway Catering and Tourism Corporation — website (rows are trains, columns are number, name, departure and arrival), or a price list on a shopping site. In each case a column heading such as Marks or Fee (₹) applies to every value beneath it.
Poor candidates are equally easy to recognise. A block of continuous writing belongs in a <p> element. A set of navigation links or a simple list of points belongs in <ul> or <ol>. A single photograph with a line of text beneath it is not tabular at all.
There is one historical use you should know about because older books and older pages still show it. In the early years of the web, designers used tables to lay out the whole page — one cell for the banner, one for a side menu, one for the main content. This worked, but it made the code long and hard to change, and the markup no longer described what the data meant. Modern practice is to place data in tables and to control the arrangement and appearance of the page with CSS (Cascading Style Sheets), a separate language for presentation. Your syllabus still requires you to know the presentation attributes covered later in this chapter, so learn them for the paper — but state, when the question invites it, that CSS is the preferred modern method.
A last point of vocabulary that examiners like. The word row always means a horizontal line of cells and is created by one <tr> element. A column is vertical, and there is no column tag in the basic syllabus — columns are formed automatically because every row contributes one cell to each column position. This is why a table looks correct only when every row supplies the same number of column positions, a rule you will meet again when you study colspan and rowspan.
- A table arranges data in rows (horizontal) and columns (vertical); their meeting point is a cell.
- Use a table only when each row is a record and each column is a shared property — a marks sheet or a timetable, not a paragraph.
- Lists of links or points belong in <ul>/<ol>, not in a table.
- Tables were once used for whole-page layout; modern practice uses CSS (Cascading Style Sheets) for that.
- Rows are created by <tr> tags; columns are formed automatically, so every row must supply the same number of column positions.
