Navigation Bar (Why its...)

RandomRyan

Member
Nov 7, 2013
37
4
Hey.

I have a VERY quick question on why the bar is doing this. It is spacing its self from the top and the sides. I don't want it like that.

Screen shot of the problem:


Here's my code:
HTML:
HTML:
<div id="nav">
    <ul>
        <li><a href="#">Home</a></li>
        <li><a href="#">Music</a></li>
        <li><a href="#">Education</a></li>
        <li><a href="#">Fun</a></li>
        <li><a href="#">Entertainment</a></li>
        <li><a href="#">Utilities</a></li>
    </ul>
</div>
CSS:
Code:
#nav {
    list-style: none;
    font-weight: bold;
    margin-bottom: 10px;
    width: 100%;
    text-align: center;
    background-color: #000000;
    height:38px;
}

Thanks
#nav ul {
    list-style-type: none;
    margin: 0px;
    padding: 0;
    width: 100%;
}

#nav li {
    margin: 0px;
    display:
}

#nav li a {
    padding: 10px;
    text-decoration: none;
    font-weight: bold;
    color: #FFFFFF;
    background-color: #000000;
    float: left
}

#nav li a:hover {
    color: #FFFFFF;
    background-color: #35af3b;
}
 

Sysode

Front-End Developer
Dec 11, 2012
1,673
848
For those having a similar problem, the fix is to remove the padding/margin on the body that is there by default. You can do this by adding this to your body styling:

html, body { margin:0; padding:0; }

Sorry for formatting, on phone.
 

Users who are viewing this thread

Top