Solved

HTML Menu bar background color

Posted on 2014-10-13
6
204 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 52

Expert Comment

by:Julian Hansen
ID: 40379222
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
ID: 40379632
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 52

Accepted Solution

by:
Julian Hansen earned 500 total points
ID: 40379684
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
ID: 40379717
Awesome, thanks!
0
 
LVL 52

Expert Comment

by:Julian Hansen
ID: 40379735
You are welcome - thanks for the points.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
Find out what you should include to make the best professional email signature for your organization.
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
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…

920 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

12 Experts available now in Live!

Get 1:1 Help Now