Website Navigation Menu
The code for this week's session contains:
- A simple(ish) navigation bar, made with:
- A heading,
- Some links,
- And a <nav> element (similar to a div).
The source code consists of three files, a file for the homepage, one for the about page, and one for the CSS.
The HTML code for the homepage for this week is as follows:
<!DOCTYPE html>
<html>
<head>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<nav>
<h1>Welcome to my website!</h1>
<a href="home.html">Home</a>
<a href="about.html">About</a>
</nav>
</body>
</html>
The HTML code for the about page for this week is as follows:
<!DOCTYPE html>
<html>
<head>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<nav>
<h1>About</h1>
<a href="home.html">Home</a>
<a href="about.html">About</a>
</nav>
</body>
</html>
The CSS code for this week is as follows:
body {
margin: 0;
}
nav h1 {
display: inline-block;
margin: 0;
padding: 10px;
font-size: 30px;
font-family: "Verdana";
color: white;
}
nav {
background-color: turquoise;
}
nav a {
position: relative;
float: right;
color: white;
font-size: 30px;
padding: 10px;
}