Golang Tutorials - Learn Go Programming with Easy Step-by-Step Guides

Explore comprehensive Golang tutorials for beginners and advanced programmers. Learn Go programming with easy-to-follow, step-by-step guides, examples, and practical tips to master Go language quickly.

Tables in HTML

Tables in HTML

? Tables in HTML

Tables in HTML are used to organize and display data in rows and columns.


? Basic Table Structure

<table>  <tr>    <th>Header 1</th>    <th>Header 2</th>  </tr>  <tr>    <td>Data 1</td>    <td>Data 2</td>  </tr></table>

? Tags Used:

TagDescription
<table>Creates the table
<tr>Table row
<th>Table header cell (bold, centered)
<td>Table data cell

? Add Border and Styling

<table border="1">  <tr>    <th>Name</th>    <th>Age</th>  </tr>  <tr>    <td>Alice</td>    <td>25</td>  </tr></table>

Or with CSS:

<style>  table {    border-collapse: collapse;    width: 50%;  }  th, td {    border: 1px solid #999;    padding: 8px;    text-align: left;  }  th {    background-color: #f2f2f2;  }</style>

? Advanced Features

Merging Cells:

  • colspan – merge columns

  • rowspan – merge rows

<td colspan="2">Merged Column</td><td rowspan="2">Merged Row</td>

? Table Example

<table>  <tr>    <th>Product</th>    <th>Price</th>    <th>Available</th>  </tr>  <tr>    <td>Laptop</td>    <td>$999</td>    <td>??</td>  </tr>  <tr>    <td>Phone</td>    <td>$499</td>    <td>?</td>  </tr></table>

? Tips

  • Always use <thead>, <tbody>, and <tfoot> for large tables.

  • Use CSS for better appearance and responsiveness.


Would you like a responsive table example or a downloadable HTML table template?

Disclaimer for AI-Generated Content:
The content provided in these tutorials is generated using artificial intelligence and is intended for educational purposes only.
html
docker
php
kubernetes
golang
mysql
postgresql
mariaDB
sql