?
Solved

Increase drop-down menu width in CSS

Posted on 2011-10-28
1
Medium Priority
?
522 Views
Last Modified: 2012-05-12
Hi,

I have a horizontal navigation menu with drop-down menu, the navigation menu has the look of the folder tab.  However, the drop-down menu has the same width with folder tab menu, how can I increase the width of drop-down menu.  Below is my code, thank you.

#navsite ul {
    width: 100%;
    float: left;
 padding: 0;
 margin-left: 0;
 /*border-bottom: 1px solid #778; */
 margin-bottom: -2px;
 margin-top:-1px;
 font:normal 12px Verdana, sans-serif;
 text-align:center;
}
#navsite ul li {
 list-style: none;
 margin: 0;
 float: left;
}
#navsite ul li a {
 padding: 5px 0.5em;
 margin-left: 2px;
 border: 0px solid #778;
 border-bottom: none;
 border-right:1px solid black;
 border-left: 1px solid black;
 background-color: #003656;
 text-decoration: none;
 background-image:  url(../9780596155933/example_code/title-glass.png);
 background-position: 50%;
 background-repeat: repeat-x;
 display: block;
 width: 6em;
}
#navsite ul li a:link {
 color: white;
}
#navsite ul li a:visited {
 /*color: #667;*/
 color: white;
}
#navsite ul li a:link:hover, #navsite ul li a:visited:hover {
 color: #FFFFF;
 background-color: #0066ff;  /*mouseover ul*/
 border-color: #227;
}
#navsite ul li a#current {
 background-color: white;
 border-bottom: 1px solid white;
color: #448;
margin-bottom: -1px;
}
#navsite ul li a#current:hover {
 background-image:  url(../9780596155933/example_code/title-glass.png);
 background-position: 50%;
 background-repeat: repeat-x;
}

/**************************  THIS IS THE DROP-DOWN MENU   */
#navsite ul li ul {
position: absolute;
 width: 7em;
 left: -999em;
 float: none;
 border-bottom: none;
}
 
   
#navsite ul li:hover ul {left: auto;}
#navsite ul li ul li a {
 background: #003656;
 border: 0px solid black;
 margin-top: 4px;
}

*************************
<div id="navsite">

 <ul>
  <li><a href="index.html">HOME</a></li>
  <li><a href="About.html">ABOUT</a></li>
  <li><a href="/archives/">ARCHIVES</a></li>
  <li><a href="/writing/">WRITING</a>
           <ul>
              <li><a href="/writing/releasing-css">Releasing CSS</a></li>
              <li><a href="/writing/css-cookbook">CSS Cookbook</a></li>
            </ul>
        
  </li>
  <li><a href="/speaking/">SPEAKING</a></li>
  <li><a href="/contact/">CONTACT</a></li>
 
   </ul>
</div>
   

0
Comment
Question by:5281
1 Comment
 
LVL 30

Accepted Solution

by:
LZ1 earned 2000 total points
ID: 37045229
Add a width to your #navsite ul li ul li a {

#navsite ul li ul li a {
 background: #003656;
 border: 0px solid black;
 margin-top: 4px;
 width:200px;
}

Open in new window

0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
In this tutorial viewers will learn how to style different bullet points for unordered lists in CSS. Begin with a normal unordered list; the default bullet point is a solid circle: In the CSS, create a defined class of unordered list by typing "ul.S…
Suggested Courses

850 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