Solved

HTML Menu bar background color

Posted on 2014-10-13
6
220 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 57

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 57

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 57

Expert Comment

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

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

724 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