Table IN HTML
The <table> tag in HTML is used to create structured grids for displaying data in rows and columns. It's comprised of nested elements like <tr> for rows, <td> for data cells, and <th> for headers. Tables offer a systematic way to organize information, commonly used in displaying datasets, schedules, or product listings on web pages. With additional attributes and CSS styling, tables can be customized for better readability and presentation.
Basic Structure :
Header 1 | Header 2 |
---|---|
Data 1 | Data 2 |
Attributes like 'border', 'cellpadding', and 'cellspacing' can be added to adjust the table appearance. Additionally, attributes like colspan and rowspan control cell span across columns and rows respectively. CSS can further enhance table styling and responsiveness.
Example 1 :
Month | Savings |
---|---|
January | $100 |
February | $80 |
Output :
Month | Savings |
---|---|
January | $100 |
February | $80 |
Example-2:Table with color and border:
PBA INSTITUTE | COURSE FEES |
---|---|
JAVA | 6000 |
WEB DESIGN | 5000 |