html - positioning a nav bar so it's fixed -


    <!doctype html public "-//w3c//dtd xhtml 1.0  transitional//en""http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head>   <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <link href="main.css" rel="stylesheet"/> <title>vasilios lambos</title> </head>  <body> <div class="header"> <a class="logo" href="home.html"><img src="vl-logo.png"></a> </div> <nav role="navigation"> <div class="nav">     <a href="home.html">home</a></li>      <a href="portfolio.html">portfolio</a></li>     <a href="process.html">process</a></li>     <a href="#">contact</a></li>  </div> </nav> <div class="jumbotron"> <h1>vaslios lambos</h1> <p>industrial , interaction designer</p>  </div>  <div class="info"> <div class="container"> <h3>overview</h3> <p> ### </p>  </div>  </div> <div class="footer"> <h3>soft & hard skills</h3> <ul>     <li>adobe suite</li>     <li>axure rp</li>     <li>html/css/javascript</li>  </ul>  </div>   </body> </html>  @charset "utf-8";  @font-face { font-family: verdana, geneva, sans-serif; }  body { font-family:verdana, geneva, sans-serif; background-color: #fff; margin:auto; /*border:2px solid red;*/ }  div.header { float:right; }   div.nav a{ background-color: #fff; color: #000; font-size: 11px; font-weight: bold; margin: 0px; padding:32px; text-transform:uppercase; text-decoration:none; /*border-radius: 4px 4px 4px 4px;*/  }   div.nav a:hover {  background-color: orange;  }  div.jumbotron{ position:relative; top:30px; background-color: #000; color:white; text-align:center; padding:20px; height:400px; }   div.info { background-color: #fff; color:black; padding:20px; height:400px; } div.footer{ background-color:#000; color:white; height:400px; clear:both; padding:20px; } 

i want make navigational bar fixed on site when scroll , down stays in 1 place. planning display images , design work , interfaces designed in photoshop , put in axure.

my site updated code , can seen @ vasilioslambos.com

best wrap want static in new div i.e.

<body> <div id="fixed"> <div class="header"> <a class="logo" href="home.html"><img src="vl-logo.png"></a> </div> <nav role="navigation"> <div class="nav">     <a href="home.html">home</a></li>      <a href="portfolio.html">portfolio</a></li>     <a href="process.html">process</a></li>     <a href="#">contact</a></li>  </div> </nav> </div> 

css

#fixed{position:fixed; top:0; width:100%; z-index:9999;/*high z-index nothing can hide it*/ background:rgb(255,255,255); padding:5px 0; } *{margin:0;padding:0;} 

and change

div.nav a{ background-color: #fff; color: #000; font-size: 11px; font-weight: bold; margin: 0px; padding:5px 32px;/* dont need 32px on top, left, bottom, right*/ text-transform:uppercase; text-decoration:none; /*border-radius: 4px 4px 4px 4px;*/  } 

this affect jumbotron you'd better not using position property on of sections. use override if html code doesn't automatically align.

psst remove position property jumbotron , it'll fit place


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -