I'm looking to right align the "pop-up" menu of my nav structure to the right edge of the div. Currently, it is "popping out" of the div. Any suggestions on how to accomplish this?
.main-navigation {
background-color: #2f9fa8;
}
.subMenu li:hover > a {
color: #e3d174;
text-decoration: underline;
}
#GeneralInfo {
width: 160px;
padding-top: 5px;
padding-left: 20px;
}
#Registration {
width: 200px;
padding-top: 5px;
padding-left: 20px;
}
#ScientificPrograms {
width: 175px;
padding-top: 5px;
padding-left: 20px;
}
#SpecialEvents {
width: 110px;
padding-top: 5px;
padding-left: 20px;
}
#Careers {
width: 70px;
padding-top: 5px;
padding-left: 20px;
}
#Exhibits {
width: 90px;
padding-top: 5px;
padding-left: 20px;
}
.subMenu {
width: 200px;
}
#navMenu ul,
#navMenu {
list-style-type: none;
margin: 0;
padding: 0;
}
.nav > li > a {
display: block;
height: 100%;
color: #FFFFFF;
text-decoration: none;
padding: 0;
font-size: 14px;
font-weight: 800;
outline: none;
}
.nav > li > a:hover {
display: block;
height: 100%;
padding: 0;
color: #FFFFFF;
text-decoration: none;
background: #2f9fa8;
}
.nav > li {
padding: 0;
float: left;
height: 30px;
font-family: Arial, sans-serif;
font-size: 14px;
background-color: #2f9fa8;
}
.nav li {
position: relative;
}
.nav li > ul {
position: absolute;
display: none;
border-bottom: 0;
z-index: 9999;
}
.nav li > ul > li > a {
text-decoration: none;
color: #FFFFFF;
font-weight: 600;
display: block;
background: #2f9fa8;
text-shadow: none;
padding: 5px 3px 5px 10px;
text-indent: -7px;
}
.nav li:hover > ul {
display: block;
}
<nav class="main-navigation">
<ul id="navMenu" class="nav">
<li id="GeneralInfo"><a class="gradient" href="#">General Information</a>
<ul class="subMenu" id="sub-GeneralInfo">
<li><a href='#'>Annual Meeting</a>
</li>
<li><a href='#'>San Diego, CA</a>
</li>
<li><a href='#'>Supporters</a>
</li>
<li><a href='#'>Just for the Media</a>
</li>
<li><a href='#'>Volunteer</a>
</li>
<li><a href='#'>Awards and Fellowships</a>
</li>
<li><a href='#'>FAQs</a>
</li>
<li><a href='#'>Forms</a>
</li>
<li><a href='#'>Events and Maps</a>
</li>
<li><a href='#'>Meeting Requests</a>
</li>
<li><a href='#'>Visa Information</a>
</li>
<li><a href='#'>Transportation</a>
</li>
<li><a href='#'>Ride Share Program</a>
</li>
<li><a href='#'>Restaurants</a>
</li>
<li class='last'><a href='#'>Top Reasons to Attend</a>
</li>
</ul>
</li>
<li id="Registration"><a class="gradient" href="#">Registration & Housing</a>
<ul class="subMenu" id="sub-Registration">
<li><a href='#'>Online Registration</a>
</li>
<li><a href='#'>Registration Information</a>
</li>
<li><a href='#'>Housing Reservations</a>
</li>
<li class='last'><a href='#'>Room Share Program</a>
</li>
</ul>
</li>
<li id="ScientificPrograms"><a class="gradient" href="#">Scientific Programs</a>
<ul class="subMenu" id="sub-ScientificPrograms">
<!--<li><a href='#'>Submit a Session Proposal</a></li>-->
<li><a href='#'>Submit an Abstract</a>
</li>
<li><a href='#'>Mobile Event App</a>
</li>
<!--<li><a href='#'>Scientific Session Index</a></li>-->
<!--<li><a href='#'>Abstract Author Index</a></li>-->
<!--<li><a href='#'>Abstract Keyword Index</a></li>-->
<li><a href='#'>Continuing Education</a>
</li>
<li><a href='#'>Continuing Medical Education</a>
</li>
<li><a href='#'>Scientific Sessions</a>
</li>
<li><a href='#'>Thematic Approach</a>
</li>
<!--<li><a href='#'>Scientific ePosters</a></li>-->
<li class='last'><a href='#'>Presentation Instructions</a>
</li>
</ul>
</li>
<li id="SpecialEvents"><a class="gradient" href="#">Special Events</a>
<ul class="subMenu" id="sub-SpecialEvents">
<li><a href='#'>Outreach</a>
</li>
<li><a href='#'>Featured Sessions</a>
</li>
<li><a href='#'>Social Events</a>
</li>
<li><a href='#'>Student and Postdoc Scholar Events</a>
</li>
<li><a href='#'>Satellite Meetings</a>
</li>
<li><a href='#'>Meeting Requests</a>
</li>
<li class='last'><a href='#'>Virtual Global Gallery Posters</a>
</li>
</ul>
</li>
<li id="Careers"><a class="gradient" href="#">Careers</a>
<ul class="subMenu" id="sub-Careers">
<li><a href='#'>Career Sessions</a>
</li>
<li><a href='#'>Career Resources and Development Services</a>
</li>
<li class='last'><a href='#'>Job Bank</a>
</li>
</ul>
</li>
<li id="Exhibits"><a class="gradient" href="#">Exhibits</a>
<ul class="subMenu" id="sub-Exhibits">
<li><a href='#'>ToxExpo</a>
</li>
<li><a href='#'>Exhibitor Listing</a>
</li>
<li><a href='#'>Exhibitor-Hosted Session Application</a>
</li>
<li><a href='#'>Exhibitor-Hosted Sessions</a>
</li>
<li><a href='#'>Support Opportunities</a>
</li>
<li class='last'><a href='#'>Supporter Listing</a>
</li>
</ul>
</li>
</ul>
</nav>
You can fint it also in codepen
If you are looking to right align the popup menu .nav li ul to the container "trigger" menu element then you should simply add right: 0; to .nav li > ul
Like:
.nav li > ul {
position: absolute;
display: none;
border-bottom: 0;
right: 0;
z-index: 9999;
}
Related
I want to make line between cell and cell, but IDK how to make it. So I made left line instead of center line. I write this question to improve this design. (cell's left line > line between cell and cell)
#menu li,
#menu li a {
display: table-cell;
border-bottom: 1px solid #DCDCDC;
}
#menu>li {
border-left: 1px solid #DCDCDC;
}
#menu>li>a {
display: table-cell;
outline: inherit;
outline-color: black;
}
#menu>li.active>a {
color: white;
background: #F2B470;
}
<div class="menu-bar">
<div id="menu">
<li class="active"><a href='#'>menu 1</a></li>
<li><a href='#'>menu 2</a></li>
<li><a href='#'>menu 3</a></li>
<li><a href='#'>menu 4</a></li>
<li><a href='#'>menu 5</a></li>
<li><a href='#'>menu 6</a></li>
</div>
</div>
Make it simple, is this is what you looking for?
#menu li,
#menu li a {
display: inline-block;
}
li a {
display: inline-block;
padding: 0 10px;
border-left: 1px solid black;
}
#menu > li.active > a {
color: white;
background: #F2B470;
}
<div class="menu-bar">
<div id="menu">
<li class="active"><a href='#'>menu 1</a></li>
<li><a href='#'>menu 2</a></li>
<li><a href='#'>menu 3</a></li>
<li><a href='#'>menu 4</a></li>
<li><a href='#'>menu 5</a></li>
<li><a href='#'>menu 6</a></li>
</div>
</div>
I have 3 drop-down menus under nav, and I want to align them left, middle, and right. The left and right alignment are working using float, but I'm having difficulty to align a drop-down menu to the middle. Please see the css selector
.inline-menu.middle-menu at https://jsfiddle.net/xv51vkc7/.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>My Title</title>
<link rel="stylesheet" type="text/css" href="css/theme_1.css">
</head>
<body>
<nav>
<ul class="inline-menu left-menu">
<li>Left-A
<ul>
<li>1</li>
<li>2</li>
</ul>
</li>
<li>Left-B
<ul>
<li>1</li>
<li>2</li>
</ul>
</li>
</ul>
<ul class="inline-menu middle-menu">
<li>Middle-A
<ul>
<li>1</li>
<li>2</li>
</ul>
</li>
<li>Middle-B
<ul>
<li>1</li>
<li>2</li>
</ul>
</li>
</ul>
<ul class="inline-menu right-menu">
<li>Right-A
<ul>
<li>1</li>
<li>2</li>
</ul>
</li>
<li>Right-B
<ul>
<li>1</li>
<li>2</li>
</ul>
</li>
</ul>
</nav>
</body>
</html>
body{
background-color: #eee;
padding: 0;
}
.inline-menu,
.inline-menu ul{
list-style: none;
padding: 0;
margin: 0;
}
.inline-menu > li{
display: inline-block;
padding-right: 25px;
background-color: yellow;
position: relative;
}
.inline-menu a{
text-decoration: none;
}
.inline-menu > li > ul{
display: none;
position: absolute;
background-color: green;
}
.inline-menu > li:hover > ul{
display: block;
width: 100%; /* same width as parent */
}
.inline-menu.left-menu{
float: left;
}
.inline-menu.right-menu{
float: right;
}
.inline-menu.middle-menu{
}
Flexbox can do that:
body {
background-color: #eee;
padding: 0;
}
nav {
display: flex;
justify-content: space-between;
}
.inline-menu,
.inline-menu ul {
list-style: none;
padding: 0;
margin: 0;
}
.inline-menu > li {
display: inline-block;
padding-right: 25px;
background-color: yellow;
position: relative;
}
.inline-menu a {
text-decoration: none;
}
.inline-menu > li > ul {
display: none;
position: absolute;
background-color: green;
}
.inline-menu > li:hover > ul {
display: block;
width: 100%;
/* same width as parent */
}
.inline-menu.left-menu {
float: left;
}
.inline-menu.right-menu {
float: right;
}
.inline-menu.middle-menu {
float: left;
}
<nav>
<ul class="inline-menu left-menu">
<li>Left-A
<ul>
<li>1
</li>
<li>2
</li>
</ul>
</li>
<li>Left-B
<ul>
<li>1
</li>
<li>2
</li>
</ul>
</li>
</ul>
<ul class="inline-menu middle-menu">
<li>Middle-A
<ul>
<li>1
</li>
<li>2
</li>
</ul>
</li>
<li>Middle-B
<ul>
<li>1
</li>
<li>2
</li>
</ul>
</li>
</ul>
<ul class="inline-menu right-menu">
<li>Right-A
<ul>
<li>1
</li>
<li>2
</li>
</ul>
</li>
<li>Right-B
<ul>
<li>1
</li>
<li>2
</li>
</ul>
</li>
</ul>
</nav>
I have html and css that does the fly out menu. Is it possible to put a border around the fly out box.
#WebPartWPQ4 {
width: 1040px!important;
//height: 200px!important;
overflow: hidden!important;
}
/*edit */
#WebPartWPQ6_ChromeTitle {
//width:50px!important;
position: absolute;
top: -40px;
z-index: 0;
}
#MSOZoneCell_WebPartWPQ6 {
position: absolute;
top: 500px
}
#cssmenu {
padding: 0;
margin: 0;
border: 0;
position: relative;
z-index: 1;
}
#cssmenu ul,
#cssmenu ul li,
#cssmenu ul ul,
#cssmenu ul ul ul {
list-style: none;
margin: 0;
padding: 0;
border: 0;
}
#cssmenu ul {
position: relative;
z-index: 397;
}
#cssmenu ul li {
min-height: 1px;
line-height: 1em;
vertical-align: middle;
}
#cssmenu ul li:hover {
position: relative;
//z-index: 99;
cursor: default;
}
#cssmenu ul ul {
visibility: hidden;
position: absolute;
top: 100%;
left: 0;
/* z-index: 398; */
width: 100%;
}
#cssmenu ul ul ul {
top: 0px;
left: 99%;
}
#cssmenu ul li:hover > ul {
visibility: visible;
width: 170px;
}
#cssmenu ul ul {
bottom: 0px;
left: 0;
}
/* Custom CSS Styles */
#cssmenu ul {
width: 100px;
}
#cssmenu ul ul {
width: 167px;
}
#cssmenu ul li {
padding: 7px 10px;
color: #000000;
//background-color: #F0F9FC;
background-color: #FFF;
//border: 1px solid red;
//border-bottom: 1px solid gray;
}
#cssmenu ul li:hover {
background: #cce5ff;
color: #000;
box-shadow: 1px 1px 10px 2px #888;
border-style: solid;
}
#cssmenu ul a:link,
#cssmenu ul a:visited {
color: #000;
text-decoration: none;
}
#cssmenu ul a:hover {
color: #000;
}
#cssmenu ul a:active {
color: #ffa500;
}
<div id='cssmenu'>
<ul>
<table cellpadding="1" cellspacing="1" style="width: 100%;">
<tbody>
<tr>
<td>
<li>
<img alt="Find" src="http://inside.colgate.in/_layouts/15/images/siteicons/Find.png" style="width: 150px; height: 150px;" />
<ul>
<li><a href='http://inside.colgate.in/sites/sales/Policies/Forms/RegionAll.aspx'><span>Policies/Forms</span></a>
</li>
<li><a href='http://inside.colgate.in/sites/sales/Policies/Forms/RegionCompanyWide.aspx'><span> - Company-wide</span></a>
</li>
<li><a href='http://inside.colgate.in/sites/sales/Policies/Forms/RegionCASpecial.aspx'><span> - CA Special</span></a>
</li>
<li><a href='http://inside.colgate.in/sites/sales/Policies/Forms/RegionSouthWestDeepWater.aspx'><span> - SouthWest Inboard</span></a>
</li>
<li><a href='http://inside.colgate.in/sites/sales/Policies/Forms/RegionSouthWestShelf.aspx'><span> - SouthWest Shelf</span></a>
</li>
<li><a href='http://inside.colgate.in/sites/sales/Policies/Forms/RegionLABasin.aspx'><span> - Basin</span></a>
</li>
<li><a href='http://inside.colgate.in/sites/sales/Policies/Forms/RegionSanJoaquinValley.aspx'><span> - Deep Valley</span></a>
</li>
<li><a href='http://www.google.com/world'><span>Safety Data Sheet (SDS)</span></a>
</li>
<li><a href='http://www.google.com/world'><span>Safety Alerts</span></a>
</li>
</ul>
</li>
</td>
<td>
<li>
<img alt="Report/Suggest" src="http://inside.colgate.in/_layouts/15/images/siteicons/ReportSuggest.png" style="width: 150px; height: 150px;" />
<ul>
<li><a href='http://www.google.com'><span>An Incident</span></a>
</li>
<li><a href='http://www.google.com'><span>An Emergency</span></a>
</li>
<li><a href='http://www.google.com'><span>An Observation</span></a>
</li>
<li><a href='http://www.google.com'><span>A Suggestion</span></a>
</li>
</ul>
</li>
</td>
<td>
<li>
<img alt="My Stuff" src="http://inside.colgate.in/_layouts/15/images/siteicons/MyStuff.png" style="width: 150px; height: 150px;" />
<ul>
<li><a href='http://www.google.com'><span>My Training</span></a>
</li>
<li><a href='http://www.google.com'><span>My PPE</span></a>
</li>
<li><a href='http://www.google.com'><span>My Safety Committee</span></a>
</li>
<li><a href='http://www.google.com'><span> - CA Special</span></a>
</li>
<li><a href='http://www.google.com'><span> - SouthWest Inboard</span></a>
</li>
<li><a href='http://www.google.com'><span> - LA Basin</span></a>
</li>
<li><a href='http://www.google.com'><span> - Valley</span></a>
</li>
<li><a href='http://www.google.com'><span>My Floor Wardens</span></a>
</li>
<li><a href='http://www.google.com'><span> - Cloverfield</span></a>
</li>
<li><a href='http://www.google.com'><span> - Oklahoma</span></a>
</li>
<li><a href='http://www.google.com'><span> - New York</span></a>
</li>
<li><a href='http://www.google.com'><span>Adjust My Workstation</span></a>
</li>
</ul>
</li>
</td>
<td>
<li>
<img alt="Emergency" src="http://inside.colgate.in/_layouts/15/images/siteicons/Emergency.png" style="width: 150px; height: 150px;" />
<ul>
<li><a href='http://www.google.com'><span>Emergency Numbers and Guides</span></a>
</li>
<li><a href='http://www.google.com'><span> - Cloverfield</span></a>
</li>
<li><a href='http://www.google.com'><span> - CA Special</span></a>
</li>
<li><a href='http://www.google.com'><span> - SouthWest Inboard</span></a>
</li>
<li><a href='http://www.google.com'><span> - SouthWest Shelf</span></a>
</li>
<li><a href='http://www.google.com'><span> - Oklahoma</span></a>
</li>
<li><a href='http://www.google.com'><span> - Orleans</span></a>
</li>
<li><a href='http://www.google.com'><span> - Basin</span></a>
</li>
<li><a href='http://www.google.com'><span> - New York</span></a>
</li>
<li><a href='http://www.google.com'><span> - Valley</span></a>
</li>
<li><a href='http://www.google.com'><span>Incident Management/ICS</span></a>
</li>
<li><a href='http://www.google.com'><span>Business Continuity</span></a>
</li>
<td>
<li>
<img alt="Contractors" src="http://inside.colgate.in/_layouts/15/images/siteicons/Contractors.png" style="width: 150px; height: 150px;" />
<ul>
<li><a href='http://www.google.com/world'><span>Contractor Portal</span></a>
</li>
<li><a href='http://www.google.com/world'><span>ISNetworld</span></a>
</li>
<li><a href='http://www.google.com/world'><span>Pocket Guidebook</span></a>
</li>
</ul>
</li>
</td>
<td>
<li>
<img alt="Get Info" src="http://inside.colgate.in/_layouts/15/images/siteicons/GetInfo.png" style="width: 150px; height: 150px;" />
<ul>
<li><a href='http://www.google.com'><span>Orientation Materials</span></a>
</li>
<li><a href='http://www.google.com/world'><span> - Company-wide</span></a>
</li>
<li><a href='http://www.google.com/world'><span> - CA Special</span></a>
</li>
<li><a href='http://www.google.com/world'><span> - SouthWest Inboard</span></a>
</li>
<li><a href='http://www.google.com/world'><span> - SouthWest Shelf</span></a>
</li>
<li><a href='http://www.google.com/world'><span> - Basin</span></a>
</li>
<li><a href='http://www.google.com/world'><span> - Valley</span></a>
</li>
<li><a href='http://www.google.com/world'><span>External Links</span></a>
</li>
<li><a href='http://www.google.com/world'><span>User Guides</span></a>
</li>
</ul>
</li>
</td>
</ul>
</li>
</td>
</tr>
</tbody>
</table>
</ul>
</div>
I tried this but it didnt help at ul li
border-style: solid;
Try this remove bottom: 0 from line 88 in the JSFiddle and add border.
/* at line 88 in JSFiddle change this */
#cssmenu ul ul {
bottom: 0;
left: 0;
}
/* to this */
#cssmenu ul ul {
border: 1px solid #ccc;
left: 0;
}
By setting bottom: 0 you're effectively telling your dropdown menu's ul to have a height of 0 and therefore the border only looks like it's applied to the top of the dropdown.
There is a menu :
<div id="divmenuppal"> // this the menu
<ul class="dropdown">
<li class="menuppal">Administration
<ul>
<li>Artificial Turf</li>
<li>
Batting Cages
<ul>
<li>Indoor
<ul>
<li>Garden</li>
</ul>
</li>
<li>Outdoor</li>
</ul>
</li>
<li>Benches & Bleachers</li>
<li>Communication Devices</li>
<li>Dugouts</li>
<li>Fencing & Windscreen</li>
<li><hr></li>
<li>Floor Protectors</li>
<li>Foul Poles</li>
<li>Netting</li>
<li>Outdoor Furniture</li>
<li>Outdoor Signs</li>
<li><hr></li>
<li>Padding</li>
<li>Scoreboards</li>
<li>Shade Structures</li>
<li> - VIEW ALL - </li>
</ul>
</li>
<li class="menuppal">Structure
<ul>
<li>All-in-One Team Cart</li>
<li>Air & Electrical Reels</li>
<li>Field Drags</li>
<li>
Field Marking Equipment
<ul>
<li>Batter's Box Templates</li>
<li>Dryline Markers</li>
<li>Field Paint
<ul>
<li>Garden</li>
</ul>
</li>
<li>Field Sprayers</li>
<li>Stencils</li>
</ul>
</li>
<li>
Field Tarps
<ul>
<li>Area Tarps</li>
<li>Growth Covers / Protectors</li>
<li>Infield Tarps</li>
<li>Tarp Accessories</li>
</ul>
</li>
<li>Hand Tools</li>
<li>
Irrigation, Hoses, Nozzles
<ul>
<li>Hoses & Hose Reels</li>
<li>Irrigation</li>
<li>Nozzles</li>
</ul>
</li>
<li>Layout Tools</li>
<li>Moisture Removal</li>
<li><hr></li>
<li>Mound Fortification</li>
<li>Mowers & Stripers</li>
<li>Soil Management</li>
<li>Soil Amendments</li>
<li>Spreaders & Sweepers</li>
<li> - VIEW ALL - </li>
</ul>
</li>
<li class="menuppal">Exercice
<ul>
<li>
Baseball - Softball
<ul>
<li>Base Accessories</li>
<li>Bases & Home Plates</li>
<li>Game Accessories</li>
<li>Pitching Rubbers</li>
</ul>
</li>
<li>
Batting Practice Equipment
<ul>
<li>Backstops</li>
<li>Infield Screens</li>
<li>Jugs Pitching Machines</li>
<li>Turf Mats</li>
<li>Turf Protectors</li>
<li>Replacement Accessories</li>
</ul>
</li>
<li>
Batting Cages
<ul>
<li>Indoor</li>
<li>Outdoor</li>
</ul>
</li>
<li>
Portable Mounds
<ul>
<li>Batting Practice Mounds</li>
<li>Game Mounds</li>
<li>Practice Mounds</li>
</ul>
</li>
<li>
Football
<ul>
<li>First Down Markers</li>
<li>Football Accessories</li>
<li>Football Goalposts</li>
</ul>
</li>
<li>
Soccer
<ul>
<li>Soccer Goals</li>
<li>Soccer Accessories</li>
</ul>
</li>
<li> - VIEW ALL - </li>
</ul>
</li>
<li class="menuppal">Contribuables et biens
<ul>
<li>Ladders & Sticks</li>
<li>Hurdles</li>
<li>Training Accessories</li>
<li>Smart-Cart Training System</li>
<li>Smart-Hurdle Collection</li>
<li> - VIEW ALL - </li>
</ul>
</li>
<li class="menuppal">Recettes
<ul>
<li>Field Design</li>
<li>Turf Management</li>
<li>Training</li>
<li> - VIEW ALL - </li>
</ul>
</li>
<li class="menuppal">Edition
<ul>
<li>Field Design</li>
<li>Turf Management</li>
<li>Training</li>
<li> - VIEW ALL - </li>
</ul>
</li>
<li class="menuppal">Outils
<ul>
<li>Field Design</li>
<li>Turf Management</li>
<li>Training</li>
<li> - VIEW ALL - </li>
</ul>
</li>
</ul>
</div>
<div class="breadcrumbs" style="clear:left;"> // this is the breadcrumbs
<div class="container-fluid">
<ul class="bread">
<li>Accueil</li><li>Gestion des contribuables</li><li><a>Fiche d'un contribuable</a></li>
</ul>
<ul class="bread pull-right">
<li style="color: #000;padding: 5px;font-size: 11px;font-weight: bold;">Fiche d'un contribuable</li>
</ul>
</div>
</div>
The css of the menu :
* {
margin: 0;
padding: 0;
}
body {
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
}
a {
text-decoration: none;
font-size: 11px;
font-weight: 100;
width: 100%;
box-sizing: border-box;
}
ul {
list-style: none;
}
ul.dropdown ul {
width: 220px;
visibility: hidden;
position: absolute;
background-color: #40617C;
}
ul.dropdown li:not(.menuppal):not(:first-child):not(:last-child)
{
margin-top: 8px;
margin-bottom: 8px;
}
hr {
margin-left: 6px;
margin-right: 8px;
border-top: 0;
}
/*
LEVEL ONE : MAIN MENU
*/
ul.dropdown {
position: relative;
}
ul.dropdown li.menuppal {
float: left;
zoom: 1;
background: #000 url(../images/menuLight.png) repeat-x top left;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-left: 1px solid #222;
}
ul.dropdown li.menuppal a {
display: block;
padding: 4px 8px;
color: #000000;
}
/* Doesn't work in IE */
ul.dropdown li.menuppal:hover {
background: #ccc url('../images/menuDark.png') repeat-x 50% 50%;
position: relative;
}
/*
FIN LEVEL ONE
*/
/*
LEVEL TWO
*/
ul.dropdown ul {
top: 100%;
left: 0;
}
ul.dropdown ul li {
float: none;
position: relative;
}
/* IE 6 & 7 Needs Inline Block */
ul.dropdown li.menuppal ul li a {
border-right: none;
color: #FFF;
display: inline-block;
}
ul.dropdown li.menuppal ul li a:hover {
background: #07243a;
}
ul.dropdown li.menuppal ul li a:visited {
word-break: break-all;
}
/*
LEVEL THREE
*/
ul.dropdown ul ul {
left: 100%;
top:0!important;
}
/*
LEVEL FOUR
*/
ul.dropdown ul ul ul {
left: 100%;
top:0!important;
}
ul.dropdown li:hover > ul {
visibility: visible;
}
At runtime the menu is not occupying all the horizontal space :
So how to make the menu fill the remaining space like in this image :
ul.dropdown {
background: #000 url(../images/menuLight.png) repeat-x top left;
}
Use flex layout. I add following code to the bottom of your CSS and it did the trick:
#divmenuppal > .dropdown {
display: flex;
}
.dropdown .menuppal:last-child {
flex-grow: 1;
}
http://jsfiddle.net/w2n79nsy/
ok I found it from #SunilDalal's answer :
ul.dropdown {
position: relative;
float: left;
width: 100%;
background: #000 url('menuLight.png') repeat-x top left;
}
I have a 3-level deep, unordered list I'm styling to create a drop-down menu to extend this 2-level simple drop-down menu. The CSS is as follows:
#CHARSET "ISO-8859-1";
/* menu styles */
/* Top-level (Styles Works) */
#jsddm
{ margin: 0;
padding: 0}
#jsddm li
{ float: left;
list-style: none;
font: 12px Tahoma, Arial;}
#jsddm li a
{ display: block;
/*background: #324143; Old Style*/
background: -webkit-linear-gradient(top, rgba(238,238,238,1) 0%,rgba(204,204,204,1) 100%); /* Chrome10+,Safari5.1+ */;
padding: 5px 12px;
text-decoration: none;
border-right: 1px solid white;
width: 70px;
/*color: #EAFFED; Default color*/
color: #000099;
white-space: nowrap;}
#jsddm li a:hover
{ background: #24313C}
/* 2nd-level (Styles Works) */
#jsddm li ul
{ margin: 0;
padding: 0;
position: absolute;
visibility: visible;
border-top: 1px solid white}
#jsddm li ul li
{ float: none;
display: inline}
#jsddm li ul li a
{ width: auto;
background: #dfeffc;
color: #24313C}
#jsddm li ul li a:hover
{ background: #5c9ccc}
/* 3rd-level (Doesn't apply styles) */
#jsddm li ul li ul
{ margin: 0;
padding: 0;
position: absolute;
visibility: hidden;
border-top: 2px solid green}
The styling works for the first two levels, but not for the 3rd, I'm not sure if I have the syntax correct or if there's something else I'm missing. The html is as follows:
<div id="dropDownDiv">
<ul id="jsddm">
<li><a class="btn" href="#">Top Item 1</a>
<ul>
<li><a id="" class="btn" href="#">2nd Level Item 1</a></li>
<li>2nd Level Item 2</li>
</ul>
</li>
<li><a class="btn" href="#">Top Item 2</a>
<ul>
<li><a id="" class="btn hide" href="#">2nd Level Item 1</a></li>
<ul>
<li><a id="" class="btn hide" href="#">3rd Level Item 1</a></li>
<li><a id="" class="btn" href="#">3rd Level Item 1</a></li>
</ul>
<li><a id="" class="btn" href="#">2nd Level Item 1</a></li>
</ul>
</li>
</ul>
</div>
Any suggestions are appreciated.
UPDATE:
Thanks for loaning me your eyes Gareth. Corrected html:
<ul id="jsddm">
<li><a class="btn" href="#">Top Item 1</a>
<ul>
<li><a id="" class="btn" href="#">2nd Level Item 1</a></li>
<li>2nd Level Item 2</li>
</ul>
</li>
<li><a class="btn" href="#">Top Item 2</a>
<ul>
<li><a id="" class="btn hide" href="#">2nd Level Item 1</a>
<ul>
<li><a id="" class="btn hide" href="#">3rd Level Item 1</a></li>
<li><a id="" class="btn" href="#">3rd Level Item 1</a></li>
</ul>
</li>
<li><a id="" class="btn" href="#">2nd Level Item 1</a></li>
</ul>
</li>
</ul>
Your third level ul is not contained within an li. That might be causing your problem.