html - Fixed header overlap -
i trying have fixed header site making , content layered beneath header. want have content drawn in under header without user having scroll up. if @ possible user no not see whitespace above content.
here made far http://jsfiddle.net/5qwzw/.
<!doctype html> <html lang="en"> <head> <title>elemental fury</title> <meta charset="utf-8" name="discription" content="best game evar!!"> <meta name="viewport" content="width=device-width, user-scalable=no"> <link href="main.css" type="text/css" rel="stylesheet"> <script src="script.js"></script> </head> <body> <center> <nav> <table class="navtable"> <tr> <td align="center" class="navitem"><a href="#fire"><img class="navimage" src="images/fire.jpg" alt="fire"></a></td> <td align="center" class="navitem"><a href="#air"><img class="navimage" src="images/air.jpg" alt="air"></a></td> <td align="center" class="navitem"><a href="#earth"><img class="navimage" src="images/earth.jpg" alt="earth"></a></td> <td align="center" class="navitem"><a href="#water"><img class="navimage" src="images/water.jpg" alt="water"></a></td> </tr> </table> </nav> <section> <h1 class="title">fancy logo</h1> <div id="fire" class="page"> <h1>fire</h1> <img src="images/archer%20fire.jpg"/> <img src="images/mage%20fire.jpg"/> <img src="images/soldier%20fire.jpg" /> </div> <div id="water" class="page"> <h1>water</h1> <img src="images/archer%20water.jpg"/> <img src="images/mage%20water.jpg"/> <img src="images/soldier%20water.jpg"/> </div> <div id="air" class="page"> <h1>air</h1> <img src="images/archer%20air.jpg"/> <img src="images/mage%20air.jpg"/> <img src="images/soldier%20air.jpg"/> </div> <div id="earth" class="page"> <h1>earth</h1> <img src="images/archer%20earth.jpg"/> <img src="images/mage%20earth.jpg"/> <img src="images/soldier%20earth.jpg"/> </div> </section> <footer> <a href="#rules">rules</a> </footer> </center> </body> </html>
and css
nav{ height: 106px; width: 100%; background-color: #ddd; padding: 0px; border: 0px; top: 0px; left: 0px; box-shadow: 6px 6px 5px #d0d0d0; position: fixed; z-index: 2; } .navitem{ width: 2%; } .navimage{ height: 100px; width: 100px; } .navimage:hover{ box-shadow: 10px 5px 5px #888888; } .page{ display: none; position: absolute; top: 400px; } section{ margin-top: 400px; } .page:target{ display: block; position: relative; top: 40px; }
the images have saved locally had substitute line breaks. becomes problem when 1 clicks on 1 of navigation links on top of page.
add padding equal height of header each of anchored divs.
for example:
.page { padding-top:106px; }
Comments
Post a Comment