Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

CSS Tables

PROPERTIES FUNCTION
Table, th, td { Applying width and border to a table. Converting
width: 100%; from standard double borderline table into single
border-collapse: collapse; line table.
border: 1px solid;
table { Specify table border without applying border
border: 2px solid; adjustments in th and td.
th { Adjust the height of th.
height: 70px;
td { Use to place or align data (left, center, right, top,
text-align: center; center and bottom)
height: 50px;
vertical-align: bottom;
th, td { Adds a single border at the top, right, left, bottom
padding: 8px; of the data
text-align: left;
border-bottom: 1px solid;
tr:hover {background-color: coral;} To highlight table rows on mouse over:

EXAMPLE TABLE
<!DOCTYPE html>
<html>
<head>
<title>table</title>
<link rel=”stylesheet” href=”sample.css”>
</head>
<body>
<table>
<tr>
<th>Firstname</th>
<th>Lastname</th>
</tr>
<tr>
<td>Eugene</td>
<td>Rivera</td>
</tr>
<tr>
<td>Gabriel</td>
<td>Torres</td>
</tr>
<tr>
<td>Rafael</td>
<td>Galvan</td>
</tr>
</table>
</body>
</html>

You might also like