header - CSS: Links float past headerbar? -


demo: http://www.mindtale.com/test.html

i'm pretty new css using wrong code in here. trying have website can resize screen size @ same time, want links have, portfolio , contact, permanently placed stay on headerbar instead of floating off left or right beyond it. how fix this?

thanks help! :d

test.html

<html> <head> <link rel="stylesheet" type="text/css" href="style.css">  <title>mindtale test home</title> </head>  <body>     <!-- header -->  <div id="headerlogo"> <a href="index.html"><img src="images/logo.png"></a></div>  <div id="headerfill"></div> <div id="header"></div>  <div id="headerlink1">  <a href="portfolio.html">portfolio</a> </div>  <div id="headerlink2"> <a href="contact.html">contact</a> </div>   <!-- content --> <div id="content"> <h2>a random heading</h2> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p>  <h2>a random heading</h2> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> <p>content placeholder ... </p> </div>  <!-- footer -->  <div id="footer"> mindtale &copy; 2013 </div>  </body> </html> 

style.css

html {  height:100%; /* fix height 100% ie */ max-height:100%; /* fix height other browsers */ background: url(images/bg.jpg) no-repeat center center fixed; /* add background image */ -webkit-background-size: cover; /* fix height other browsers */ -moz-background-size: cover; /* fix height other browsers */ -o-background-size: cover; /* fix height other browsers */ background-size: cover; /* fix height other browsers */ }  /* header */ /* -------------------------------------------------- */    div#header { z-index:3; position:fixed; background: url(images/header.png) no-repeat center; height: 102px; top:0px; left:0px; width:100%; padding: 0px; }  div#headerfill { z-index:4; position:fixed; background: url(images/headerfill.png) repeat-x; height: 98px; top:0px; left:0px; width:100%; padding: 0px; }  div#headerlink1 { font-family: "lucida sans unicode", "lucida grande", sans-serif; font-size:90%; z-index:4; position:fixed; top:55px; left:18%; color:#999; padding: 0px; }  div#headerlink2 { font-family: "lucida sans unicode", "lucida grande", sans-serif; font-size:90%; z-index:4; position:fixed; top:55px; left:78%; color:#999; padding: 0px; }  div#headerlogo { z-index:5; position:fixed; top:30px; left:42%; color:#999; padding: 0px; }  /* content */ /* -------------------------------------------------- */  div#content { position:fixed; width:100%; color:#222; top: 70px;  bottom: 0;  left: 0;  right: 0; padding: 25px; overflow: auto;    font-family: "lucida sans unicode", "lucida grande", sans-serif;  }   /* footer */ /* -------------------------------------------------- */  div#footer { position:fixed; bottom:0px; left:0px; width:100%; color:#999; background:#333; padding: 8px; }     enter code here 

i made fiddle have rebuilt html , css , can see working (couldn't resist). http://jsfiddle.net/david_knowles/2y7u5/1/

you'll see there lot less code.

the main pointer give wise make more use of cascade in styles. hence css = cascading style sheets. it's key efficient front-end coding. nest html more :-) (less styles need then).

div id="headerlogo">     <div id="headerfill">         <div id="header">             <a href="portfolio.html" id="headerlink1" >portfolio</a>             <a href="index.html"> <img src="http://www.mindtale.com/images/logo.png" alt="mindtale"> </a>             <a href="contact.html" id="headerlink2" >contact</a>         </div>     </div> </div>  <!-- content --> <div id="content">    <h2>a random heading</h2>    <p>content placeholder ... </p>     ... </div> 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -