0% found this document useful (0 votes)
4 views

HTML -Table

The document provides guidelines for styling HTML tables, including properties for borders, background color, and text color. It explains the use of <th> for table headers, <tr> for table rows, and <td> for table cells. An example of a basic HTML table is also included, showcasing the application of these styling rules.

Uploaded by

hiisslikj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

HTML -Table

The document provides guidelines for styling HTML tables, including properties for borders, background color, and text color. It explains the use of <th> for table headers, <tr> for table rows, and <td> for table cells. An example of a basic HTML table is also included, showcasing the application of these styling rules.

Uploaded by

hiisslikj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Table

Styling the table:


●​ border-collapse: collapse; It makes the border a single line.
●​ background- color: lightblue; It changes the background color.
●​ color: darkblue; It changes the color of the text.
●​ <table style="width:100%"> It changes the width of the cell into 100.
●​ <th style="width:70%">Firstname</th> It changes the width of the cell into 70.
●​ border-color: darkred; It changes the color of the border.

Note: A table cell can contain all sorts of HTML elements: text, images, lists, links, other tables,
etc.

Table Headers

Sometimes you want your cells to be table header cells. In those cases use the <th> tag instead
of the <td> tag: th stands for table header.

Table Rows

Each table row starts with a <tr> and ends with a </tr> tag. tr stands for table row.

Table Cells

Each table cell is defined by a <td> and a </td> tag. td stands for table data.

Everything between <td> and </td> is the content of a table cell.

The following values are used to create border:


<!DOCTYPE html>
<html>
<style>
table, th, td {
border:1px solid white
;
​ ​ ​ ​ }
</style>

<body>
<h2>A basic HTML table</h2>
<table style="width:60%; background-color:lightcoral; border-collapse: collapse; color:white; ">
<tr>
<th>Company</th>
<th>Contact</th>
<th>Country</th>
</tr>
<tr >
<td>Nutella</td>
<td>Berlin</td>
<td>Germany</td>
</tr>
<tr >
<td >IBM</td>
<td>Rome</td>
<td>Italy</td>
</tr>

<tr >
<td >Benz</td>
<td>Munich</td>
<td>Germany</td>
</tr>

<tr >
<td >Audi</td>
<td>Frankfurt</td>
<td>Germany</td>
</tr>
</table>

You might also like