Solved

HTML Menu bar background color

Posted on 2014-10-13
6
212 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 55

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 55

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 55

Expert Comment

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

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
In this tutorial viewers will learn how to style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…
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 …

830 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