Solved

HTML Menu bar background color

Posted on 2014-10-13
6
200 Views
Last Modified: 2014-10-14
I've got a web page that I am updating.  One of the things I am doing is adding a horizontal menu bar.  The bar is in place and works fine, but the background color wont set as desired.  The menu items background is correctly set to #69F, but the rest of the horizontal stripe across the page is not.  It stays #FFF instead of #69F.  It is midnight and I'm sure it is something really stupid simple, and I'm going to slap myself, but what am I doing wrong?

Here is the CSS:
#hmenubar > div
{
    width: 100%;
    height: auto;
    background-color: #69F;
    margin: 0 0 3em 0;
    margin-top: 0px;
	margin-right: 0px;
    text-align: center;
    float: none;
}

.hmenu ul {
    background: #69F;
    background-color: #69F;
}

.hmenu a {
    text-decoration: none;
    text-align: center;
    color: #00F;
    background: #69F;
    background-color: #69F;
    width: auto;
    height: auto;
    margin: 0px 0px 0px 0px;
    /*margin: 0 0 3em 0;*/
    /*margin: 0px auto;*/
    font-size: 18px;
    float: none;
    padding: 8px 8px 8px 8px;
    border-top: 3px solid #ccc;
    border-bottom: 3px solid #ccc; 
    display: inline-block;
}

.hmenu li { 
    display: inline; 
    /*padding: 10px; */
    background: #69F;
    background-color: #69F;
    margin: 0px auto;
}

.hmenu a:hover {
    color: #00F;
    background-color: #F88017;
    border-bottom: 3px solid black;
    margin: 0px auto;
}

.hmenu a:active {
    color: #00F;
    background-color: #F88017;
    background: #69F;
    background-color: #69F;
    border-bottom: 3px solid black;
    margin: 0px auto;
}

Open in new window

And Here is the HTML code:
        <div class="hmenubar" >
            <center>
                <ul class="hmenu">
                    <li><a href="index.html">Home</a></li>
                    <li><a href="aboutUs.html">About Us</a></li>
                    <li><a href="services.html">Services</a></li>
                    <li><a href="plans.html">Plans</a></li>
                    <li><a href="reviews.html">Reviews</a></li>
                    <li><a href="careers.html">Careers</a></li>
                    <li><a href="blog.html">Blog</a></li>
                </ul>
            </center>
        </div> <!-- End DIV hmenubar -->

Open in new window


Thanks.
0
Comment
Question by:cef_soothsayer
  • 3
  • 2
6 Comments
 
LVL 51

Expert Comment

by:Julian Hansen
Comment Utility
You are adding the background to the <a> and <li> elements if you want the "stripe" along the top to have a background you need to give a background colour to your <ul>

ul {
  background: #69f;
}

Open in new window

0
 
LVL 1

Author Comment

by:cef_soothsayer
Comment Utility
I'm already using this code, it that not sufficient?
I have other UL in the site that I don't want to background color.

.hmenu ul {
    background: #69F;
    background-color: #69F;
}

Open in new window

0
 
LVL 51

Accepted Solution

by:
Julian Hansen earned 500 total points
Comment Utility
That should be

ul.hmenu

Open in new window


The way you have it is you are referring to child <ul> elements of elements with the .hmenu class.
0
 
LVL 1

Author Closing Comment

by:cef_soothsayer
Comment Utility
Awesome, thanks!
0
 
LVL 51

Expert Comment

by:Julian Hansen
Comment Utility
You are welcome - thanks for the points.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

As a result of several questions about how to use Bootstrap I thought it would be a good idea to write down the development aspect of creating a Bootstrapped website in as little time as possible. Part 1 of this article will only concentrate on g…
Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now