Download ArticleDownload Article

This How.com.vn 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.

Part 1
Part 1 of 2:

Creating a Table

Download Article
  1. How.com.vn English: Step 1 Open a text-editing program.
    You'll typically use Notepad++ on Windows and TextEdit on Mac. To find these programs:
    • Windows - Open Start
      How.com.vn English: Windows Start
      , type notepad into Start, and click Notepad at the top of the window.
    • Mac - Open Spotlight
      How.com.vn English: Mac Spotlight
      , type in textedit, and click TextEdit below the Spotlight search field.
  2. How.com.vn English: Step 2 Type in <table> and press ↵ Enter.
    The <table> 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.
    Advertisement
  3. How.com.vn English: Step 3 Type in <tr> and press ↵ Enter.
    This command indicates that you'll be creating a specific element of the table.
  4. How.com.vn English: Step 4 Add a column to your table.
    Type in <th> to indicate a column, type in the label for the column, type in </th> to close the column, and press Enter.
    • For example: to create a table column labeled "Number of Dogs", you would type <th>Number of Dogs</th> into your text editor.
  5. How.com.vn English: Step 5 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.
  6. How.com.vn English: Step 6 Type in </tr> 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.
  7. How.com.vn English: Step 7 Type in <tr> again, then press ↵ Enter.
    You'll now add your rows to your table.
  8. How.com.vn English: Step 8 Add a cell to your table.
    Type in <td> to indicate a piece of information below the first column, type in the information, type in </td> to close the cell, and press Enter.
    • For example: to create a cell with the number "23" in it, you would type <td>23</td> into your text editor.
  9. How.com.vn English: Step 9 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.
  10. How.com.vn English: Step 10 Close the current row.
    Type in </tr> and press Enter to close the row. At this point, you can open another row by typing in <tr> and pressing Enter, adding individual cells, and then closing the row.
  11. How.com.vn English: Step 11 Close your table.
    Below the final line of the table, type in </table>. This indicates the end of the table.
  12. How.com.vn English: Step 12 Review your table.
    Your table should look something like this:[1]
    • <table>
    • <tr>
    • <th>Day</th>
    • <th>Month</th>
    • <th>Year</th>
    • </tr>
    • <tr>
    • <td>4</td>
    • <td>March</td>
    • <td>1990</td>
    • </tr>
    • <tr>
    • <td>27</td>
    • <td>July</td>
    • <td>1993</td>
    • </tr>
    • </table>
  13. How.com.vn English: Step 13 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.
  14. Advertisement
Part 2
Part 2 of 2:

Adding Table Modifiers

Download Article
  1. How.com.vn English: Step 1 Widen your table.
    Replace the <table> tag at the top of the sheet with <table and then type style="width:100%"> into the tag. Make sure that you keep a space between "table" and "style".
    • The end result should look like this: <table style="width:100%">
    • You can experiment with the percentage. For example, typing in 50 instead of 100 will result in a half-as-wide table.
  2. How.com.vn English: Step 2 Create borders for your table.
    Create a space at the very top of the document above the <table> tag, then do the following:
    • Type in <style> and press Enter.
    • Type in table, th, td { and press Enter.
    • Type in border: 1px solid black; and press Enter.
    • Type in border-collapse: collapse; and press Enter. Skip this line if you want your borders to have two lines instead of one.
    • Type in } and press Enter.
    • Type in </style> and press Enter.
  3. How.com.vn English: Step 3 Add a label for your table.
    Create a space just below the <table> tag, then do the following:
    • Type in <caption>
    • Type in the text that you want to use (e.g., Birthdays)
    • Type in </caption> and press Enter.
      • Your end result should resemble this: <caption>Birthdays</caption>
  4. Advertisement

Community Q&A

Search
Add New Question
  • Question
    How do I put a border on the table?
    How.com.vn English: Community Answer
    Community Answer
    You can go into the css for 'table' and change the border. It might look something like this:table {border: 1px solid #fff;}
  • Question
    How do I insert pictures into the table?
    How.com.vn English: Community Answer
    Community Answer
    You can do that by adding a tag where the text would usually be.
  • Question
    What will the table look when it is done?
    How.com.vn English: Community Answer
    Community Answer
    It will look like a simple collection of boxes with black outlines with the text inside, much like a spreadsheet.
See more answers
Ask a Question
200 characters left
Include your email address to get a message when this question is answered.
Submit
      Advertisement

      Video

      Tips

      • To make certain text bold, you can place <b></b> tags around the text in question. For example, to turn "Number of Years" into "Number of Years", you'd type <b>Number of Years</b> into the text editor.
      • It helps to indent related sections of code so that you can easily reference them later. For example, you might indent an entire section of cells.
      Submit a Tip
      All tip submissions are carefully reviewed before being published
      Thanks for submitting a tip for review!
      Advertisement

      Warnings

      Advertisement

      About This Article

      How.com.vn English: Jack Lloyd
      Co-authored by:
      How.com.vn Technology Writer
      This article was co-authored by How.com.vn staff writer, Jack Lloyd. Jack Lloyd is a Technology Writer and Editor for How.com.vn. He has over two years of experience writing and editing technology-related articles. He is technology enthusiast and an English teacher. This article has been viewed 215,956 times.
      How helpful is this?
      Co-authors: 11
      Updated: October 23, 2023
      Views: 215,956
      Categories: HTML
      Article SummaryX

      1.Use the TABLE tag to start and end the table.
      2.Use the TR tag to open and close table rows.
      3.Use the TH tag to open and close column headers.
      4.Use the TD tag to open and close cell values.

      Did this summary help you?

      Thanks to all authors for creating a page that has been read 215,956 times.

      Is this article up to date?

      ⚠️ Disclaimer:

      Content from Wiki How English language website. Text is available under the Creative Commons Attribution-Share Alike License; additional terms may apply.
      Wiki How does not encourage the violation of any laws, and cannot be responsible for any violations of such laws, should you link to this domain, or use, reproduce, or republish the information contained herein.

      Notices:
      • - A few of these subjects are frequently censored by educational, governmental, corporate, parental and other filtering schemes.
      • - Some articles may contain names, images, artworks or descriptions of events that some cultures restrict access to
      • - Please note: Wiki How does not give you opinion about the law, or advice about medical. If you need specific advice (for example, medical, legal, financial or risk management), please seek a professional who is licensed or knowledgeable in that area.
      • - Readers should not judge the importance of topics based on their coverage on Wiki How, nor think a topic is important just because it is the subject of a Wiki article.

      Advertisement