Banner image for a switzCodes blog post titled ‘Creating Tables – Organizing Data in HTML,’ featuring the switzCodes logo in dark blue, white, and green with a grid-inspired background.

📋 Creating Tables - Organizing Data in HTML

📅 August 19, 2025

✍️ By Evans

Hey hey! 👋

I've reached a new chapter in my HTML learning journey — HTML tables. At first, tables looked a bit scary (all those <tr>, <td>, and <th> tags flying around 😅), but once I understood the structure, it all clicked.

Let me break it down the way I understood it — plain and simple.

🧱 What Is a Table in HTML?

A table is used to show data in rows and columns, like this:

Name Age Country
Evans 20 Nigeria
Ada 22 Ghana

Pretty cool, right? You can build that in HTML using just a few tags.

🧪 Basic Table Structure

Here's the basic format I learned:


<table>
  <tr>
    <th>Name</th>
    <th>Age</th>
    <th>Country</th>
  </tr>
  <tr>
    <td>Evans</td>
    <td>22</td>
    <td>Nigeria</td>
  </tr>
  <tr>
    <td>Ada</td>
    <td>21</td>
    <td>Ghana</td>
  </tr>
</table>
                            

Let's explain the tags:

  • <table> - starts the table
  • <tr> - means table row
  • <th> - table heading (bold and centered by default)
  • <td> - table data (regular cells)

🧠 How I Remember It

Think of it like this:

  • Every <tr> is a row.
  • Inside each row, you put cells: either <th> for headers or <td> for data.
  • Rows stack vertically. Data cells go side-by-side inside rows.

It's like a spreadsheet, but written in code.

🎨 Adding Borders (Because It Looks Too Plain!)

By default, HTML tables look boring. You can add a border like this:


<table border="1">
  <!-- table content here -->
</table>
                        

But I also learned that it’s better to style it with CSS (more on that later!).

😅 Mistakes I Made

  • ❌ Used <td> inside the wrong place (outside <tr>)
  • ❌ Forgot to close tags — messed up my layout
  • ❌ Didn’t add borders, and thought the table was invisible 😆

🧪 My Sample Table Practice


<h2>My Learning Progress</h2>
<table border="1">
  <tr>
    <th>Topic</th>
    <th>Status</th>
  </tr>
  <tr>
    <td>HTML Basics</td>
    <td>✅ Done</td>
  </tr>
  <tr>
    <td>CSS Styling</td>
    <td>⏳ Learning</td>
  </tr>
  <tr>
    <td>JavaScript</td>
    <td>🛠️ Coming Soon</td>
  </tr>
</table>
                        

Seeing that table pop up in my browser felt so good!

🎯 Final Thoughts

Tables might look tricky at first, but they're just a combo of rows and cells. They're super useful when you want to organize data clearly — whether it's scores, schedules, or even shopping lists.

👉 What's Next?

Next, I'll be learning about HTML forms — so I can start building pages where users can enter info. That sounds fun (and powerful) 💪

Until next time,

Keep learning, keep coding 👨💻

— Evans 💻