How to make tables in html

To create tables in HTML, you'll use the <table>, <tr>, <th>, and <td> elements:

  • <table>: Defines the table itself.
  • <tr>: Stands for table row and defines each row within the table.
  • <th>: Represents table header cells (typically the headings of columns or rows).
  • <td>: Represents standard cells in the table, containing data.

Here's an example of a simple table with two rows and two columns:

        
            <table border="1">
                <tr>
                    <th>Header 1</th>
                    <th>Header 2</th>
                </tr>
                <tr>
                    <td>Data 1</td>
                    <td>Data 2</td>
                </tr>
            </table>         
        
    

This code will generate a basic table with a border attribute to make the table borders visible. Replace the content within <th> and <td> tags with your actual data.

To add more rows or columns, simply replicate the <tr>, <th>, or <td> elements within the <table> element.

Here's an example of a table with multiple rows and columns:

        
            <table border="1">
                <tr>
                    <th>Name</th>
                    <th>Age</th>
                    <th>Country</th>
                </tr>
                <tr>
                    <td>John</td>
                    <td>25</td>
                    <td>USA</td>
                </tr>
                <tr>
                    <td>Alice</td>
                    <td>30</td>
                    <td>Canada</td>
                </tr>
          </table>          
        
    

This would create a table with three columns and two rows, displaying information about individuals in each row.

Additionally, you can use attributes such as colspan and rowspan to define cells that span multiple columns or rows, respectively.

Tables can become complex, and they might need styling for better presentation. CSS can be used to enhance the appearance, alignment, and other visual aspects of the table. But this basic structure will help you get started with creating tables in HTML.

How To Open a Port on Linux

Opening a port on Linux involves configuring the firewall to allow traffic through the specified port. Here's a step-by-step guide to achieve this, assuming you are using ufw (Uncomplicated Firewall) or iptables for managing your firewall settings. u …

read more

How To Set Up a Multi-Node Kafka Cluster using KRaft

Setting up a multi-node Kafka cluster using KRaft (Kafka Raft) mode involves several steps. KRaft mode enables Kafka to operate without the need for Apache ZooKeeper, streamlining the architecture and improving management. Here’s a comprehensiv …

read more