htmlcssskeleton-css-boilerplate

Why won't my background Nav bar change colour?


I am using the skeleton framework and am trying make a simple nave bar?

When I try and create a nav-bar div and set the css nav- bar id colour to blue the background won't change. However if i try and change the individual columns the colour will change. Is there a way will a grid framework to create a consistent nav bar on top with out telling each column to be a certain colour. this seems silly. Also is it possible to have a nav bar that extends past the frameworks 960px length? I would like to have the bar background extend to both sides of the screen.

<!DOCTYPE html>
<html>

<head>
    <link rel="stylesheet" type="text/css" href="skeleton.css">
    <link rel="stylesheet" type="text/css" href="normalize.css">
</head>
<div class="container">
    <div id="nav-bar">
        <div class="two columns">
            <h1>DS</h1>
        </div>
        <div id="nav" class="ten columns">
            <ul>
                <li><a href="#">Home</a></li>
                <li><a href="#">About</a></li>
                <li><a href="#">Portfolio</a></li>
                <li><a href="#">Contact</a></li>
            </ul>
        </div>
    </div><!---nav-bar--->
</div><!---container--->
</html>

CSS:

.container {
    margin-top: 50px;
}

#nav-bar {
    background-color: blue;
}

#nav {
    margin: 13px 0 0 0;
}

#nav ul li {
    display: inline;
    margin: 0 20px 0 0;
    margin-bottom: 130px;
}

#nav a {
    text-decoration: none;
    color: black
}

#nav a:hover {
    text-decoration: underline;
}

https://jsfiddle.net/gp9d7yvz/


Solution

  • the #nav children is floating left that make #nav has no height. Let append <div style="clear:both"></div> before the closing tag of #nav to make it have height like this fiddle.

    https://jsfiddle.net/gp9d7yvz/2/