CSS Table

Unique beauty

CSS Table:

A table in CSS is used to apply the various styling properties to the HTML Table elements to arrange the data in rows and columns, or possibly in a more complex structure in a properly organized manner. Tables are widely used in communication, research, and data analysis. The table-layout property in CSS can be utilized to display the layout of the table. This property is basically used to sets the algorithm that is used to layout <table>cells, rows, and columns.

Properties:


»Border: It is used for specifying borders in the table.

Syntax: 

border: table_width table_color;

Example: This example describes the CSS Table to apply the border property.

<!DOCTYPE html>
<html>
  
<head>
    <style>
    body {
        text-align: left;
    }
      
    h1 {
        color: green;
    }
      
    table,
    th,
    td {
        
        /* Styling the border. */
        border: 1.5px solid blue;
    }
    </style>
</head>
  
<body>
    <h1>Gocources</h1>
    <h2>Add border to table:</h2>
    <table>
        <tr>
            <th>Roll No.</th>
            <th>Name</th>
        </tr>
        <tr>
            <td>1</td>
            <td>A_B_C</td>
        </tr>
        <tr>
            <td>2</td>
            <td>X_Y_Z</td>
        </tr>
    </table>
</body>
</html>

Output:



Our website uses cookies to enhance your experience. Learn More
Accept !

GocourseAI

close
send