Here’s how to add a simple table to your web page. This table has two rows and three cells in each row:
<!DOCTYPE html> <html lang=”en”> <head> <title>The title goes here</title> <meta charset=”utf-8″> <title>Tables are Fun </title> <style type=”text/css”> table td <body> |
Let’s analyze this code. The <table> tag starts the table, the <tr> tag starts the row, and the <td> tag starts the cell. (I think it stands for “table data.”) Every opening tag has a corresponding ending tag. I’ve used embedded CSS to style the <table> and <td> tags. The table itself has a solid border. Each cell appears with a solid pink border, and each cell has 10 pixels of padding. Cell padding is the space between the contents of the cell and the cell border.
Candela Citations
- Judy's HTML5 Tutorial. Authored by: Judy Jacobs Miller. Provided by: Extended Learning Institute (ELI), Northern Virginia Community College (NOVA). Located at: http://www.nvcc.edu/home/jumiller/html_tutorial/tables.html. License: CC BY-NC-ND: Attribution-NonCommercial-NoDerivatives