<!DOCTYPE html>
<html>
<head>
<title>How to build a website</title>
<link rel=”stylesheet” href=”style.css”>
</head>
<body>
<div id=”navigation”>
<div id=”navigation-inside”>
<ul>
<li><a href=”index.html”>Home</a></li>
<li><a href=”html.html” class=”active”>HTML</a></li>
<li><a href=”css.html”>CSS</a></li>
<li><a href=”javascript.html”>JavaScript</a></li>
</ul>
</div>
</div>
<div id=”header”>
<img src=”img/header-image.jpg” alt=“Header Image”>
<div id=”profile”>
<div id=”profile-image”>
<img src=”img/profile-icon.png” alt=”Profile icon”>
</div>
byKenny Wood
</div>
</div>
<div id=”introduction”>
<h1>HTML</h1>
<p>Welcome to the dedicated HTML section. This page contains all of the HTML elements that I have understood and used so far on my journey into web design.</p>
</div>
<div id=”tables” class=”section”>
<h1>Tables</h1>
<p>Tables help us to structure data and display it in an easy to digest format.</p>
<div class=”example”>
<table>
<tr>
<th>First Column</th>
<th>Second Column</th>
<th>Third Column</th>
</tr>
<tr>
<td>Row 1 – Cell 1</td>
<td>Row 1 – Cell 2</td>
<td>Row 1 – Cell 3</td>
</tr>
<tr>
<td>Row 2 – Cell 1</td>
<td>Row 2 – Cell 2</td>
<td>Row 2 – Cell 3</td>
</tr>
</table>
</div>
<input class=”code-show-button” type=”button” value=“Show code” />
</div>
</body>
</html>
The goal here is to create a class with the same style as the introduction block, which will be reused on every section we create on our webpages. We will then add a style to highlight the example, before applying a general style to our button to bring it more in line with our webpage style.
The steps:
Write rules to achieve the following desired output per element:
Expected result: now doesn’t that look better? What you should have now seen is a centred table, sitting inside an example pane of a slightly darker background, followed by a styled button, which says ‘show code’.
Expected code: