Solved

css for menu

Posted on 2011-09-11
3
486 Views
Last Modified: 2012-05-12
Hey guys i have an menu and css friendly to convert to ul and li, my probelm is setting the select item colour in the menu.

here my code:

<div class="Menu" id="ctl00_Menu">
      <div class="AspNet-Menu-Horizontal">
                  <ul class="AspNet-Menu">
                        <li class="AspNet-Menu-Leaf  AspNet-Menu-Selected">
                              <a href="Default.aspx" class="AspNet-Menu-Link  AspNet-Menu-Selected">
                                    Profile</a>
                        </li>
                        <li class="AspNet-Menu-Leaf">
                              <a href="javascript:__doPostBack('ctl00$Menu','bAbout Us')" class="AspNet-Menu-Link">
                                    About Us</a>
                        </li>
                        <li class="AspNet-Menu-WithChildren">
                              <a href="javascript:__doPostBack('ctl00$Menu','bServices')" class="AspNet-Menu-Link">
                                    Services</a>
                              <ul>
                                    <li class="AspNet-Menu-Leaf">
                                          <a href="#" class="AspNet-Menu-Link">
                                                • Deceased Estates</a>
                                    </li>
                                    <li class="AspNet-Menu-Leaf">
                                          <a href="#" class="AspNet-Menu-Link">
                                                • Civil & Criminal Litigation</a>
                                    </li>
                                    <li class="AspNet-Menu-Leaf">
                                          <a href="#" class="AspNet-Menu-Link">
                                                • Family Law</a>
                                    </li>
                                    <li class="AspNet-Menu-Leaf">
                                          <a href="#" class="AspNet-Menu-Link">
                                                • Law of Persons</a>
                                    </li>
                                    <li class="AspNet-Menu-Leaf">
                                          <a href="#" class="AspNet-Menu-Link">
                                                • Criminal Law</a>
                                    </li>
                              </ul>
                        </li>
                        <li class="AspNet-Menu-Leaf">
                              <a href="#" class="AspNet-Menu-Link">
                                    Support Staff</a>
                        </li>
                        <li class="AspNet-Menu-Leaf">
                              <a href="Contacts.aspx" class="AspNet-Menu-Link">
                                    Contacts</a>
                        </li>
                  </ul>
 
      </div>



here my css

/* MENU --------------------------------------------------------*/

.Menu
{
}

.Menu ul li
{
      background-position: right;
      font-family: 'Century Gothic';
      font-size: 14px;
      height: 38px;
      font-weight: normal;
      line-height: 38px;
      padding-left: 20px;
      padding-right: 40px;
      background-image: url(  '../images/dots.jpg' );
      background-repeat: no-repeat;
}

.Menu ul li a
{
      color: #FFFFFF;
}

.Menu ul li a:hover
{
      color: #fec054;
}

.Menu ul li AspNet-Menu-Leaf  AspNet-Menu-Selected
{
      color: #fec054;
}


.Menu ul li ul
{
      margin-top: -3px;
}

.Menu ul li ul li
{
      padding: 0;
      z-index: 2;
      background-color: #49191c;
      background-image: url(       '../images/red_bg.jpg' );
      background-repeat: repeat;
      line-height: 25px;
      width: 170px;
}

.Menu ul li ul li a
{
      font-family: Arial;
      font-size: 12px;
      color: #FFFFFF;
      font-style: italic;
      padding-right: 10px;
      padding-left: 10px;
}

.Menu ul li ul li a:hover
{
      background-color: #582427;
      color: #FFFFFF;
}

here c# code to set the select couse the menu is in the materpage


    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            Menu menu = (Menu)(this.Master.FindControl("Menu"));
            menu.FindItem("Profile").Selected = true;
        }
    }
0
Comment
Question by:JCWEBHOST
  • 2
3 Comments
 
LVL 40

Expert Comment

by:gurvinder372
ID: 36521131
when i hover on the 'Deceased Estates', its background color changes.
Is that not the color you wanted to change?
0
 
LVL 40

Accepted Solution

by:
gurvinder372 earned 500 total points
ID: 36521146
I guess the problem is this
.Menu ul li AspNet-Menu-Leaf  AspNet-Menu-Selected
{
      color: #fec054;
}

should be replace by

.Menu ul li .AspNet-Menu-Leaf, .Menu ul li .AspNet-Menu-Selected
{
      color: #fec054;
}
0
 

Author Closing Comment

by:JCWEBHOST
ID: 36521147
thanks
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

So you have coded your own WordPress plugin and now you want to allow users to upload images to a folder in the plugin folder rather than the default media location? Follow along and this article will show you how to do just that!
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
In this tutorial viewers will learn how to customize the background color and font color of highlighted text using the ::selection element in CSS Begin by defining the selected text as an element in CSS by typing "::selection": Style the ::selection…

706 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

18 Experts available now in Live!

Get 1:1 Help Now