www.webdeveloper.com
Results 1 to 3 of 3

Thread: Please help, working on inline nav bar

Hybrid View

  1. #1
    Join Date
    Jun 2013
    Posts
    3

    Please help, working on inline nav bar

    Hello,

    Will you please look at my code and tell me what I am doing wrong? I have added padding to my inline nav bar, but I cant get the background color in active and hover states to bleed over into that padded area. Any help is greatly appreciated!! Code below:

    <nav>
    <ul>
    <li id="active"><a href="index.html" id="">Home</a></li>
    <li><a href="#">About</a></li>
    <li><a href="#">Custom Homes</a></li>
    <li><a href="#">Remodels</a></li>
    <li><a href="#">Photo Gallery</a></li>
    <li><a href="#">Testimonials</a></li>
    <li><a href="#">Contact Us</a></li>
    </ul>
    </nav>



    nav {
    background-color: #fff;
    padding: 10px;

    }

    nav li{
    display:inline;
    list-style: none;
    }

    nav li a {
    padding-right: 25px;
    padding-left: 20px;
    text-decoration:none;
    color: #333;
    }

    nav li a:hover{
    color: #FFF ;
    background-color: #a10324 ;
    }

    nav li#active a{
    color: #FFF;
    background-color: #a10324;
    height: 41px;
    }

    ul {
    background-color: #fff;

    }

  2. #2
    Join Date
    Aug 2012
    Location
    TX
    Posts
    293
    are you saying you want the link to basically appear as a block? so not that the background color is bleeding over in to the padding but you want the link to have a block of color around the link?

  3. #3
    Join Date
    Aug 2012
    Location
    TX
    Posts
    293
    if so add this to your css

    by adding display block and then a width and a height of the link it should give you the background color. the way your css is set up now you just have link with nothing declaring that there is a background. padding is like an imaginary space you need to add some code to make an area for the background to exist.

    another thing i notice that could be giving you problems is that you are declaring the active state as an ID and not a class. try changing # to .

    Code:
      nav {
    display:block;
    background-color: #fff;
    padding: 10px;
    
    }
    Last edited by Nicholas Diaz; 06-10-2013 at 11:51 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles