How to Create a Table in HTML
How to Create a Table in HTML
This wikiHow teaches you how to create a basic information table using HTML, as well as how to add helpful elements such as borders to the table.
Steps

Creating a Table

Open a text-editing program. You'll typically use Notepad++ on Windows and TextEdit on Mac. To find these programs: Windows - Open Start Windows Start, type notepad into Start, and click Notepad at the top of the window. Mac - Open Spotlight Mac Spotlight, type in textedit, and click TextEdit below the Spotlight search field.

Type in

and press ↵ Enter. The
tag indicates the start of a table, and pressing ↵ Enter prompts your text editor to start a new line. When using HTML, you always have to press ↵ Enter after creating a line of code to move onto the next line.

Type in

and press ↵ Enter. This command indicates that you'll be creating a specific element of the table.

Add a column to your table. Type in

to close the column, and press ↵ Enter. For example: to create a table column labeled "Number of Dogs", you would type into your text editor.

Add more columns. Depending on how many columns you want your table to have, this step will vary. Once you've added all of the columns that you want to use, proceed to the next step. Columns are created from left to right.

Type in

and press ↵ Enter. This command indicates that all of the table's columns have been created and closes that section of the table's code.

Type in

again, then press ↵ Enter. You'll now add your rows to your table.

Add a cell to your table. Type in

to close the cell, and press ↵ Enter. For example: to create a cell with the number "23" in it, you would type into your text editor.

Add more cells to your table. The number of cells in a row should correlate to the number of columns; for example, if you have three columns, you should have three cells in a row. Once you've created an entire row, you can proceed.

Close the current row. Type in

and press ↵ Enter to close the row. At this point, you can open another row by typing in and pressing ↵ Enter, adding individual cells, and then closing the row.

Close your table. Below the final line of the table, type in

to indicate a column, type in the label for the column, type in Number of Dogs
to indicate a piece of information below the first column, type in the information, type in 23
. This indicates the end of the table.

Review your table. Your table should look something like this:

Day Month Year
4 March 1990
27 July 1993

Save your work. Press Ctrl+S (Windows) or ⌘ Command+S (Mac) to save your document, then enter a name for the document and click Save when prompted.

Adding Table Modifiers

Widen your table. Replace the

tag at the top of the sheet with
into the tag. Make sure that you keep a space between "table" and "style". The end result should look like this:
You can experiment with the percentage. For example, typing in 50 instead of 100 will result in a half-as-wide table.

Create borders for your table. Create a space at the very top of the document above the

tag, then do the following: Type in and press ↵ Enter.

Add a label for your table. Create a space just below the

tag, then do the following: Type in and press ↵ Enter. Your end result should resemble this:

What's your reaction?

Comments

https://umorina.info/assets/images/user-avatar-s.jpg

0 comment

Write the first comment for this!
Type in the text that you want to use (e.g., Birthdays) Type in Birthdays