In: Computer Science
(See Creating Square Thumbnails section below)
a. According to the question, design the table using html and css, here the code of index.html
<!DOCTYPE html>
<html>
<head>
<title>Table two rows and three column</title>
</head>
<body>
<div class="wrapper">
<table>
<thead>
<tr>
<th id="message" colspan="2" onmouseover = "document.getElementById('message').innerHTML='My Favorites Park!';" onmouseleave = "document.getElementById('message').innerHTML='US National Park'; " onmouseout="this.style.color='black'">US National Park</th>
</tr>
</thead>
<tbody>
<tr class="math">
<td><a href="https://upload.wikimedia.org/wikipedia/commons/9/97/Logo_of_the_United_States_National_Park_Service.svg" target="_blank"><img src="https://upload.wikimedia.org/wikipedia/commons/9/97/Logo_of_the_United_States_National_Park_Service.svg" width="70px" height="70px"></a></td>
<td><a href="https://upload.wikimedia.org/wikipedia/commons/9/97/Logo_of_the_United_States_National_Park_Service.svg" target="_blank"><img src="https://upload.wikimedia.org/wikipedia/commons/9/97/Logo_of_the_United_States_National_Park_Service.svg" width="70px" height="70px"></a></td>
</tr>
<tr class="math">
<td></td>
<td></td>
</tr>
<tr class="math">
<td><a href="https://upload.wikimedia.org/wikipedia/commons/9/97/Logo_of_the_United_States_National_Park_Service.svg" target="_blank"><img src="https://upload.wikimedia.org/wikipedia/commons/9/97/Logo_of_the_United_States_National_Park_Service.svg" width="70px" height="70px"></a></td>
<td><a href="https://upload.wikimedia.org/wikipedia/commons/9/97/Logo_of_the_United_States_National_Park_Service.svg" target="_blank"><img src="https://upload.wikimedia.org/wikipedia/commons/9/97/Logo_of_the_United_States_National_Park_Service.svg" width="70px" height="70px"></a></td>
</tr>
</tbody>
</table>
</div>
</body>
</html>
now, to design the table with fancy css sytle, here the code for css
html { box-sizing: border-box; }
*,
*::before,
*::after { box-sizing: inherit; }
body,
body * {
margin: 0;
padding: 0;
}
body {
font: normal 100%/1.15 "Open Sans", sans-serif;
background-color: #fffaf0;
color: #555;
counter-reset: tb;
}
.wrapper {
position: relative;
max-width: 64em;
height: auto;
margin: 0 auto;
padding: 1em 1em;
}
table {
width: 100%;
min-width: 40em;
margin-top: 1em;
border-collapse: separate;
border-spacing: 0.25em 0.25em;
border-radius: 0.35em 0.35em;
background-color: #f5deb3;
}
thead th { background-color: #fff; }
th, td {
position: relative;
padding: 0.25em 0.25em;
border-radius: 0.35em 0.35em;
}
tbody tr:nth-of-type(odd) { background-color: #fffacd; }
tbody tr:nth-of-type(even) { background-color: #f5f5f5; }
Now, the final html page including the CSS which is embeded inside the head tag using the style tag, here the final code
<!DOCTYPE html>
<html>
<head>
<title>Table two rows and three column</title>
<style>
html { box-sizing: border-box; }
*,
*::before,
*::after { box-sizing: inherit; }
body,
body * {
margin: 0;
padding: 0;
}
body {
font: normal 100%/1.15 "Open Sans", sans-serif;
background-color: #fffaf0;
color: #555;
counter-reset: tb;
}
.wrapper {
position: relative;
max-width: 64em;
height: auto;
margin: 0 auto;
padding: 1em 1em;
}
table {
width: 100%;
min-width: 40em;
margin-top: 1em;
border-collapse: separate;
border-spacing: 0.25em 0.25em;
border-radius: 0.35em 0.35em;
background-color: #f5deb3;
}
thead th { background-color: #fff; }
th, td {
position: relative;
padding: 0.25em 0.25em;
border-radius: 0.35em 0.35em;
}
tbody tr:nth-of-type(odd) { background-color: #fffacd; }
tbody tr:nth-of-type(even) { background-color: #f5f5f5; }
</style>
</head>
<body>
<div class="wrapper">
<table>
<thead>
<tr>
<th id="message" colspan="2" onmouseover = "document.getElementById('message').innerHTML='My Favorites Park!';" onmouseleave = "document.getElementById('message').innerHTML='US National Park'; " onmouseout="this.style.color='black'">US National Park</th>
</tr>
</thead>
<tbody>
<tr class="math">
<td><a href="https://upload.wikimedia.org/wikipedia/commons/9/97/Logo_of_the_United_States_National_Park_Service.svg" target="_blank"><img src="https://upload.wikimedia.org/wikipedia/commons/9/97/Logo_of_the_United_States_National_Park_Service.svg" width="70px" height="70px"></a></td>
<td><a href="https://upload.wikimedia.org/wikipedia/commons/9/97/Logo_of_the_United_States_National_Park_Service.svg" target="_blank"><img src="https://upload.wikimedia.org/wikipedia/commons/9/97/Logo_of_the_United_States_National_Park_Service.svg" width="70px" height="70px"></a></td>
</tr>
<tr class="math">
<td></td>
<td></td>
</tr>
<tr class="math">
<td><a href="https://upload.wikimedia.org/wikipedia/commons/9/97/Logo_of_the_United_States_National_Park_Service.svg" target="_blank"><img src="https://upload.wikimedia.org/wikipedia/commons/9/97/Logo_of_the_United_States_National_Park_Service.svg" width="70px" height="70px"></a></td>
<td><a href="https://upload.wikimedia.org/wikipedia/commons/9/97/Logo_of_the_United_States_National_Park_Service.svg" target="_blank"><img src="https://upload.wikimedia.org/wikipedia/commons/9/97/Logo_of_the_United_States_National_Park_Service.svg" width="70px" height="70px"></a></td>
</tr>
</tbody>
</table>
</div>
</body>
</html>
Now, copy the above code on your system and name as index.html and view on browser, the output look like this
b. According to the instruction, the table with 4 columns with 6 rows, here the html code for index2.html
<!DOCTYPE html>
<html>
<head>
<title>Table 4 rows and 6 column</title>
</head>
<body>
<div class="wrapper">
<table>
<thead>
<tr>
<th colspan="4">Yellowstone National Park</th>
</tr>
</thead>
<tbody>
<tr class="math">
<td align="center" colspan="4" style="color: #000;">click on any image to enlarge</td>
</tr>
<tr class="math">
<td align="center"><img src="https://d279m997dpfwgl.cloudfront.net/wp/2016/08/0823_old-faithful.jpg" width="150px" height="150px"></td>
<td align="center"><img src="https://d279m997dpfwgl.cloudfront.net/wp/2016/08/0823_old-faithful.jpg" width="150px" height="150px"></td>
<td align="center"><img src="https://d279m997dpfwgl.cloudfront.net/wp/2016/08/0823_old-faithful.jpg" width="150px" height="150px"></td>
<td align="center"><img src="https://d279m997dpfwgl.cloudfront.net/wp/2016/08/0823_old-faithful.jpg" width="150px" height="150px"></td>
</tr>
<tr class="math">
<td colspan="2" align="center"><img src="https://d279m997dpfwgl.cloudfront.net/wp/2016/08/0823_old-faithful.jpg" width="150px" height="150px"></td>
<td align="center"><img src="https://www.yellowstonepark.com/.image/t_share/MTQ3MzIwMDY3OTc4NjM1MDU1/yellowstone_old_faithful.jpg" width="300px" height="300px"></td>
<td align="center"><img src="https://d279m997dpfwgl.cloudfront.net/wp/2016/08/0823_old-faithful.jpg" width="150px" height="150px"></td>
</tr>
<tr class="math">
<td align="center" rowspan="2"><p><img src="https://i.insider.com/594408f1e92b94051767da57?width=1100&format=jpeg&auto=webp" width="150px" height="150px" onclick="this.src='https://www.nps.gov/yell/learn/nature/images/hotspring_works.jpg'"></p>
<p><img src="https://i.insider.com/594408f1e92b94051767da57?width=1100&format=jpeg&auto=webp" width="150px" height="150px" onclick="this.src='https://www.nps.gov/yell/learn/nature/images/hotspring_works.jpg'"></p>
</td>
<td align="center" rowspan="2"><p><img src="https://i.insider.com/594408f1e92b94051767da57?width=1100&format=jpeg&auto=webp" width="150px" height="150px" onclick="this.src='https://www.nps.gov/yell/learn/nature/images/hotspring_works.jpg'"></p>
<p><img src="https://i.insider.com/594408f1e92b94051767da57?width=1100&format=jpeg&auto=webp" width="150px" height="150px" onclick="this.src='https://www.nps.gov/yell/learn/nature/images/hotspring_works.jpg'"></p>
</td>
<td align="center" rowspan="2"><p><img src="https://i.insider.com/594408f1e92b94051767da57?width=1100&format=jpeg&auto=webp" width="150px" height="150px" onclick="this.src='https://www.nps.gov/yell/learn/nature/images/hotspring_works.jpg'"></p>
<p><img src="https://i.insider.com/594408f1e92b94051767da57?width=1100&format=jpeg&auto=webp" width="150px" height="150px" onclick="this.src='https://www.nps.gov/yell/learn/nature/images/hotspring_works.jpg'"></p>
</td>
<td align="center" rowspan="2"><p><img src="https://i.insider.com/594408f1e92b94051767da57?width=1100&format=jpeg&auto=webp" width="150px" height="150px" onclick="this.src='https://www.nps.gov/yell/learn/nature/images/hotspring_works.jpg'"></p>
<p><img src="https://i.insider.com/594408f1e92b94051767da57?width=1100&format=jpeg&auto=webp" width="150px" height="150px" onclick="this.src='https://www.nps.gov/yell/learn/nature/images/hotspring_works.jpg'"></p>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>
To Desing the table css defined so that table look good on webpage, here the css code:
html { box-sizing: border-box; }
*,
*::before,
*::after { box-sizing: inherit; }
body,
body * {
margin: 0;
padding: 0;
}
body {
font: normal 100%/1.15 "Open Sans", sans-serif;
background-color: #fffaf0;
color: #555;
counter-reset: tb;
}
.wrapper {
position: relative;
max-width: 64em;
height: auto;
margin: 0 auto;
padding: 1em 1em;
}
table {
width: 100%;
min-width: 40em;
margin-top: 1em;
border-collapse: separate;
border-spacing: 0.25em 0.25em;
border-radius: 0.35em 0.35em;
background-color: #f5deb3;
}
thead th { background-color: #fff; }
th, td {
position: relative;
padding: 0.25em 0.25em;
border-radius: 0.35em 0.35em;
}
tbody tr:nth-of-type(odd) { background-color: #fffacd; }
tbody tr:nth-of-type(even) { background-color: #f5f5f5; }
The final code with css embeded in the html page, the css is used before the head tag using style tag, here the final code:
<!DOCTYPE html>
<html>
<head>
<title>Table 4 rows and 6 column</title>
</head>
<style>
html { box-sizing: border-box; }
*,
*::before,
*::after { box-sizing: inherit; }
body,
body * {
margin: 0;
padding: 0;
}
body {
font: normal 100%/1.15 "Open Sans", sans-serif;
background-color: #fffaf0;
color: #555;
counter-reset: tb;
}
.wrapper {
position: relative;
max-width: 64em;
height: auto;
margin: 0 auto;
padding: 1em 1em;
}
table {
width: 100%;
min-width: 40em;
margin-top: 1em;
border-collapse: separate;
border-spacing: 0.25em 0.25em;
border-radius: 0.35em 0.35em;
background-color: #f5deb3;
}
thead th { background-color: #fff; }
th, td {
position: relative;
padding: 0.25em 0.25em;
border-radius: 0.35em 0.35em;
}
tbody tr:nth-of-type(odd) { background-color: #fffacd; }
tbody tr:nth-of-type(even) { background-color: #f5f5f5; }
</style>
<body>
<div class="wrapper">
<table>
<thead>
<tr>
<th colspan="4">Yellowstone National Park</th>
</tr>
</thead>
<tbody>
<tr class="math">
<td align="center" colspan="4" style="color: #000;">click on any image to enlarge</td>
</tr>
<tr class="math">
<td align="center"><img src="https://d279m997dpfwgl.cloudfront.net/wp/2016/08/0823_old-faithful.jpg" width="150px" height="150px"></td>
<td align="center"><img src="https://d279m997dpfwgl.cloudfront.net/wp/2016/08/0823_old-faithful.jpg" width="150px" height="150px"></td>
<td align="center"><img src="https://d279m997dpfwgl.cloudfront.net/wp/2016/08/0823_old-faithful.jpg" width="150px" height="150px"></td>
<td align="center"><img src="https://d279m997dpfwgl.cloudfront.net/wp/2016/08/0823_old-faithful.jpg" width="150px" height="150px"></td>
</tr>
<tr class="math">
<td colspan="2" align="center"><img src="https://d279m997dpfwgl.cloudfront.net/wp/2016/08/0823_old-faithful.jpg" width="150px" height="150px"></td>
<td align="center"><img src="https://www.yellowstonepark.com/.image/t_share/MTQ3MzIwMDY3OTc4NjM1MDU1/yellowstone_old_faithful.jpg" width="300px" height="300px"></td>
<td align="center"><img src="https://d279m997dpfwgl.cloudfront.net/wp/2016/08/0823_old-faithful.jpg" width="150px" height="150px"></td>
</tr>
<tr class="math">
<td align="center" rowspan="2"><p><img src="https://i.insider.com/594408f1e92b94051767da57?width=1100&format=jpeg&auto=webp" width="150px" height="150px" onclick="this.src='https://www.nps.gov/yell/learn/nature/images/hotspring_works.jpg'"></p>
<p><img src="https://i.insider.com/594408f1e92b94051767da57?width=1100&format=jpeg&auto=webp" width="150px" height="150px" onclick="this.src='https://www.nps.gov/yell/learn/nature/images/hotspring_works.jpg'"></p>
</td>
<td align="center" rowspan="2"><p><img src="https://i.insider.com/594408f1e92b94051767da57?width=1100&format=jpeg&auto=webp" width="150px" height="150px" onclick="this.src='https://www.nps.gov/yell/learn/nature/images/hotspring_works.jpg'"></p>
<p><img src="https://i.insider.com/594408f1e92b94051767da57?width=1100&format=jpeg&auto=webp" width="150px" height="150px" onclick="this.src='https://www.nps.gov/yell/learn/nature/images/hotspring_works.jpg'"></p>
</td>
<td align="center" rowspan="2"><p><img src="https://i.insider.com/594408f1e92b94051767da57?width=1100&format=jpeg&auto=webp" width="150px" height="150px" onclick="this.src='https://www.nps.gov/yell/learn/nature/images/hotspring_works.jpg'"></p>
<p><img src="https://i.insider.com/594408f1e92b94051767da57?width=1100&format=jpeg&auto=webp" width="150px" height="150px" onclick="this.src='https://www.nps.gov/yell/learn/nature/images/hotspring_works.jpg'"></p>
</td>
<td align="center" rowspan="2"><p><img src="https://i.insider.com/594408f1e92b94051767da57?width=1100&format=jpeg&auto=webp" width="150px" height="150px" onclick="this.src='https://www.nps.gov/yell/learn/nature/images/hotspring_works.jpg'"></p>
<p><img src="https://i.insider.com/594408f1e92b94051767da57?width=1100&format=jpeg&auto=webp" width="150px" height="150px" onclick="this.src='https://www.nps.gov/yell/learn/nature/images/hotspring_works.jpg'"></p>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>
Copy the above code, save as file as index2.html, view on the browser when you click on last row of images the image will change, here the output on the browser looks like this: