This is an old revision of the document!
In this activity we'll test some tools for making the page more appealing and readable by introducing some spacing.
layout.html
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" href="style.css"> <title>Document</title> </head> <body> <header>Header</header> <nav>Nav</nav> <main> <div class="content">Section 1</div> <div class="content">Section 2</div> <div class="content">Section 3</div> </main> <footer><h3>Footer</h3></footer> </body> </html>
style.css
ol { color: blue; } ol ol { font-weight: 700; } ul { list-style-type: none; } td, th { border-width: 1px; border-style: solid; } td { padding: 10px; } table { border-collapse: collapse; } header { background-color:indianred; border:darkred solid 2px; height: 100px; position: absolute; left: 16%; right: 0px; } nav { background-color: burlywood; border:yellow solid 2px; position: fixed; top: 0px; bottom: 0px; width: 15%; } main { background-color: lightgreen; border: darkgreen solid 2px; position: absolute; top: 100px; left: 16%; right: 0px; bottom: 80px; overflow: scroll; } footer { background-color: lightskyblue; border: darkblue solid 2px; position: absolute; bottom: 0px; height: 80px; left: 16%; right: 0px; } .content { background-color:coral; border:orangered solid 2px; height: 400px; }
.content { background-color:coral; border:orangered solid 2px; height: 400px; padding: 40px; }
margin: 20px;
<nav>
and above <heading>
. These have been caused by default positioning of elements. See if you can find and fix this using the box-model pane of your Developer Tools.<nav>
and the other elements. This is because we used 15% width on <nav>
and width: 16%;
on the other elements. Change width on <nav>
to 16% to fix this.block
) and a top menu (inline
).display: inline-block;
width: 450px;