In: Computer Science
1. Update the HTML so the table has the caption and data shown in the second table.
a. Implement the table as a figure and use the figure caption to supply the table caption.
2. Expand the CSS so it does the formatting shown in the second table.
b. Use pseudo-classes to achieve colors
CODE:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Employee table</title>
<meta name="description" content="Activity">
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="Activity2.css">
</head>
<body>
<table>
<thead>
<tr>
<th>Name</th>
<th>E-mail</th>
<th class="right">Years of Service</th>
</tr>
</thead>
<tbody>
<tr>
<td>Joel Murach</td>
<td>[email protected]</td>
<td class="right">22</td>
</tr>
<tr>
<td>Anne Boehm</td>
<td>[email protected]</td>
<td class="right">34</td>
</tr>
<tr>
<td>Zak Ruvalcaba</td>
<td>[email protected]</td>
<td class="right">4</td>
</tr>
<tr>
<td>Judy Taylor</td>
<td>[email protected]</td>
<td class="right">39</td>
</tr>
<tr>
<td>Cyndi Vasquez</td>
<td>[email protected]</td>
<td class="right">10</td>
</tr>
<tr>
<td>Kelly Slivkoff</td>
<td>[email protected]</td>
<td class="right">25</td>
</tr>
<tr>
<td>Juliette Baylon</td>
<td>[email protected]</td>
<td class="right">1</td>
</tr>
</tbody>
</table>
<footer>
<a href="https://validator.w3.org/check?uri=referer">Validate HTML</a> <br>
<a href="https://jigsaw.w3.org/css-validator/check/referer">Validate CSS</a>
</footer>
</body>
</html>
CSS:
body
{
width: 750px;
margin: 0 auto;
}
table
{
border-collapse: collapse;
border: 1px solid black;
margin: 20px;
}
thead
{
background-color: yellow;
}
th, td
{
border: 1px solid black;
padding: .2em 1em .2em .5em;
text-align: left;
vertical-align: middle;
}
.right
{
text-align: right;
}
tbody tr:nth-child(even) td
{
background-color: yellow;
}
Code :
<!DOCTYPE html>
<html lang="en">
<head>
<title>Employee table</title>
<meta name="description" content="Activity">
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="new.css">
</head>
<body>
<figure>
<figcaption>Caption</figcaption>
<table>
<thead>
<tr>
<th>Name</th>
<th>E-mail</th>
<th class="right">Years of Service</th>
</tr>
</thead>
<tbody>
<tr>
<td>Joel Murach</td>
<td>[email protected]</td>
<td class="right">22</td>
</tr>
<tr>
<td>Anne Boehm</td>
<td>[email protected]</td>
<td class="right">34</td>
</tr>
<tr>
<td>Zak Ruvalcaba</td>
<td>[email protected]</td>
<td class="right">4</td>
</tr>
<tr>
<td>Judy Taylor</td>
<td>[email protected]</td>
<td class="right">39</td>
</tr>
<tr>
<td>Cyndi Vasquez</td>
<td>[email protected]</td>
<td class="right">10</td>
</tr>
<tr>
<td>Kelly Slivkoff</td>
<td>[email protected]</td>
<td class="right">25</td>
</tr>
<tr>
<td>Juliette Baylon</td>
<td>[email protected]</td>
<td class="right">1</td>
</tr>
</tbody>
</table>
</figure>
<footer>
<a href="https://validator.w3.org/check?uri=referer">Validate
HTML</a> <br>
<a
href="https://jigsaw.w3.org/css-validator/check/referer">Validate
CSS</a>
</footer>
</body>
</html>
CSS :
body
{
width: 750px;
margin: 0 auto;
}
table
{
border-collapse: collapse;
border: 1px solid black;
margin: 20px;
background-color: yellow;
margin: auto;
text-align: center;
}
table:hover{
background-color: orange;
}
thead
{
background-color: yellow;
}
th, td
{
border: 1px solid black;
padding: .2em 1em .2em .5em;
text-align: left;
vertical-align: middle;
}
.right
{
text-align: right;
}