I have a problem where my navigation bar seems to scale using .container in CSS. Now, I'm pretty new, but I tried messing around with the values โโin CSS, but to no avail. Here is the code for HTML and CSS:
* { margin: 0px; padding: 0px; } body { font-family: verdana; background-image: url(images/bg2.jpg); max-width: 100%; max-height: auto; background-position: 0px 100px; background-repeat: repeat-x; background-color: black; background-size: 100%; } #header { background-color: #000000; height: 100px; width: 100%; } .container { background-color: grey; width: 960px; height: auto; margin: 0 auto; color: rgb(200, 200, 200); } #logoArea { width: 300px; height: 100px; background-image: url(images/logo.png); float: left; display: block; } #navArea { height: 50%; float: right; } #nav { list-style: none; margin-top: 5%; } #nav a { color: #C8C8C8; text-decoration: none; width: 75px; height: 50px; display: table-cell; vertical-align: middle; padding: 0; } #nav li { width: 75px; height: 50px; float: left; margin-left: 30px; background-color: #252525; border: 2px solid silver; border-radius: 8px; padding: 0px; text-align: center; display: table-cell; vertical-align: middle; } #nav li:hover { background-color: grey; } .page { background-color: rgba(19, 19, 19, 0.9); padding: 20px; padding-bottom: 1px; } p { margin-bottom: 20px; } .box1 { position: relative; width: 300px; height: 100px; background-image: url(images/logo.png); background-repeat: no-repeat; float: left; } #imageLogo { width: 960px; height: 324px; background-image: url(images/Triicell-logo.png); background-repeat: no-repeat; background-position: center; }
<html> <head> <meta charset="UTF-8"> <title>Test site</title> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body a link="#C8C8C8" vlink="#C8C8C8" alink="#C8C8C8"> <div id="Header"> <div class="container"> <div class="box1"> <a id="logoArea"></a> </div> <div id="navArea"> <ul id="nav"> <li>wp_1 </li> <li>wp_2 </li> <li>wp_3 </li> <li>wp_4 </li> <li>wp_5 </li> </ul> </div> </div> </div> <div id="mainArea"> <div class="container page"> <div id="welcome">Test site</div> </div> </div> </body> </html>
As I said, I'm new, so if there is something painfully obvious that I missed, I would appreciate it if you could point me in the right direction. Iโve been racking my brains all morning trying to figure out what it could be.
Here are some screenshots to link to what I'm talking about:
Before scaling .container: 
After scaling .container: 
What I do to scale, I change the width of the .container to 50% ;. Don't worry about anything else - I know what I'm going to do to scale the rest, that is, images, etc., but it's just a navigation bar that seems to be slipping away.
But yes, I would be very grateful if anyone could help me in this matter. Otherwise, at least point me in the right direction.
source share