I have two separate working 'objects'
A menu bar, working entirely in CSS.
See it working here: http://jsbin.com/EMEraZu/1/edit?html,css,js,output
And I have a fancy CSS/Java slideshow here: http://jsbin.com/ijUW/1/edit?html,css,js,output
These work perfectly until I try to combine them together on one page, where upon the CSS mucks up.Now, every thumbnail on the slideshow is a list item (li) element, in my novice opinion, this is conflicting with the UL and LI elements in the menu bar. Is this the problem? I tried fixing it by creating a div tag for the menubar. But I've had no luck. Any suggestions?
I've copied the CSS and HTML below
#menubar ul {
text-align: left;
display: inline;
margin: 0;
padding: 15px 4px 17px 0;
list-style: none;
-webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
-moz-box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
}
#menubar ul li {
font: 18px;
font-family: latolight;
display: inline-block;
margin-right: -4px;
position: relative;
padding: 15px 20px;
background: #fff;
cursor: pointer;
-webkit-transition: all 0.2s;
-moz-transition: all 0.2s;
-ms-transition: all 0.2s;
-o-transition: all 0.2s;
transition: all 0.2s;
}
#menubar ul li:hover {
background: #555;
color: #fff;
font-family: latolight;
}
#menubar ul li ul {
padding: 0;
position: absolute;
top: 43px;
left: 0;
width: 150px;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
display: none;
opacity: 0;
visibility: hidden;
-webkit-transiton: opacity 0.2s;
-moz-transition: opacity 0.2s;
-ms-transition: opacity 0.2s;
-o-transition: opacity 0.2s;
-transition: opacity 0.2s;
}
#menubar ul li ul li {
background: #555;
display: block;
color: #fff;
text-shadow: 0 -1px 0 #000;
}
#menubar ul li ul li:hover { background: #666; }
#menubar ul li:hover ul {
display: block;
opacity: 1;
visibility: visible;
}
<div id="menubar">
<ul>
<li>Home</li>
<li>Title
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
</ul></li>
<li>
Title2
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
</ul>
</li>
</ul>
</div>
//* Above was Menubar code, it somehow conflicts with the gallery code, below,
#gallery{
/* CSS3 Box Shadow */
-moz-box-shadow:0 0 3px #AAAAAA;
-webkit-box-shadow:0 0 3px #AAAAAA;
box-shadow:0 0 3px #AAAAAA;
/* CSS3 Rounded Corners */
-moz-border-radius-bottomleft:4px;
-webkit-border-bottom-left-radius:4px;
border-bottom-left-radius:4px;
-moz-border-radius-bottomright:4px;
-webkit-border-bottom-right-radius:4px;
border-bottom-right-radius:4px;
border:1px solid white;
background:url(img/panel.jpg) repeat-x bottom center #ffffff;
/* The width */
width:920px;
overflow:hidden;
}
#slides{
height:400px;
/* jQuery willchange the width later on to the sum of the widths of all the slides. */
width:920px;
overflow:hidden;
}
.slide{
float:left;
}
#menu{
/* container for the thumbnails */
height:90px;
}
li{
/* Every thumbnail is a li element */
width:120px;
display:inline-block;
list-style:none;
height:90px;
overflow:hidden;
}
li.inact:hover{
/* The inactive state, highlighted on mouse over */
background:url(img/pic_bg.png) repeat;
}
li.act,li.act:hover{
/* The active state of the thumb */
background:url(img/active_bg.png) no-repeat;
}
.fbar{
/* The left-most vertical bar */
width:2px;
background:url(img/divider.png) no-repeat right;
}
li a{
display:block;
background:url(img/divider.png) no-repeat right;
height:70px;
padding-top:10px;
}
a img{
border:none;
}
<div id="main">
<div id="gallery">
<div id="slides">
<div class="slide"><img src="img/sample_slides/1.jpg" width="920" height="400" alt="side" /></div>
<div class="slide"><img src="img/sample_slides/2.jpg" width="920" height="400" alt="side" /></div>
<div class="slide"><img src="img/sample_slides/3.jpg" width="920" height="400" alt="side" /></div>
<div class="slide"><img src="img/sample_slides/4.jpg" width="920" height="400" alt="side" /></div>
</div>
<div id="menu">
<ul>
<li class="fbar"> </li><li class="menuItem"><img src="img/thumb_1.png" alt="thumbnail" width="85" /></li><li class="menuItem"><img src="img/thumb_2.png" alt="thumbnail" width="85" /></li><li class="menuItem"><img src="img/thumb_3.png" alt="thumbnail" width="85" /></li><li class="menuItem"><img src="img/thumb_4.png" alt="thumbnail" width="85" /></li>
</ul>
</div>
</div>
</div>
</body>
</html>
Any ideas at all would be appreciated on why they are clashing.
i think your gallery css needs to be more specific to which elements to style, like you have done with the menu css by adding parents id. as there is no id with gallery css, its going to effect all li elements
Related
I know there have been a lot of similar questions but none of the solutions worked for me. the predominant answer was to have overflow: hidden; on the ul but that's no good for me because the way i have overflow coded is essential for the menu and its transitions.
essentially i have a 2 column drop-down menu. the left column is the submenu list, the right column is an image. each main menu item has a different number of submenu items and sometimes even less than the height of the img. i want to fill the background of the ul class="twinsub" but i can't get it to pick up same as the height of the tallest list whether that be the image or the submenu list. i have tried everything i can think of with no success.
here are a couple of images to illustrate what i am trying to do:
here is the code:
Updated JS FIDDLE
HTML:
<section id="menuWrapper">
<nav id="menu" class="cf" role="navigation">
<!-- Main Nav Start -->
<ul id="main-nav" class="clearfix">
<!----------------------------------------- Solutions ------------------>
<li id="technology" class="parent menu-item">Solutions
<ul class="twinsub">
<li class="twinmultisub twinleft">
<ul>
<li id="solutions-turnkey" class="menu-item">Turnkey Development
</li>
<li id="solutions-financing" class="menu-item">Financial Modeling
</li>
<li id="solutions-execution" class="menu-item">World-Class Execution
</li>
</ul>
</li>
<li class="twinmultisub twinimg">
<section>
<img class="menuimage" src="http://milkytech.com/images/industry.png" />
</section>
</li>
</ul>
</li>
<li id="technology" class="parent menu-item">Services
<ul class="twinsub">
<li class="twinmultisub twinleft">
<ul>
<li id="services-devlopment" class="menu-item">Development & Financing
</li>
<li id="services-design" class="menu-item">Design & Engineering
</li>
<li id="services-construction" class="menu-item">Construction & Procurement
</li>
<li id="services-operations" class="menu-item">Operations & Maintenance
</li>
</ul>
</li>
<li class="twinmultisub twinimg">
<section>
<img class="menuimage" src="http://milkytech.com/images/industry.png" />
</section>
</li>
</ul>
</li>
</ul>
</nav>
CSS:
#menu {
display:inline-block;
clear:both;
height:auto;
}
#menu ul {
margin:0;
}
#menu li {
float:left;
position:relative;
}
#menu > ul > li > a {
display:block;
line-height: .4em;
}
/* Submenu (second level) */
#menu li > ul {
position:absolute;
top:auto;
left:0;
width:180px;
max-height:0;
visibility: hidden;
z-index:99999;
overflow:hidden;
}
#menu ul li:hover ul {
visibility: visible;
max-height: 330px;
width: 204px;
overflow: visible;
}
#menu ul li > ul:hover {
overflow:visible;
}
#menu li > ul li {
height:36px;
width:100%;
}
#menu li > ul li:last-child {
height: 35px;
}
#menu li > ul li a {
padding: 11px 15px;
height: 35px;
color: #FFF;
width: 100%;
display: block;
}
ul.twinsub {
clear: both;
display: inline-block;
width:408px !important;
border-right: none !important;
background-color: #5d6f82 !important;
overflow: hidden;
}
ul.twinsub > li {
display: inline-block;
border-top: none !important;
background: #FFF;
line-height: 38px;
}
li.twinmultisub {
display: block;
width: 50% !important;
}
.menuimage {
width: 100% !important;
margin-left: 1px;
border-right: none;
}
li.twinimg {
float: left;
border: none;
}
li.twinleft {
clear: both;
float: left;
border-right: none !important;
}
li.twinheader {
width: 50% !important;
text-align: left;
padding-left: 14px;
font-size: .9em;
background-color: #5d6f82 !important;
color: #FFF;
opacity: 1;
}
How about adding a wrapping div around the inner ul, and add a background color to that one.
This example should make a good beginning
.wrapp {
background: #13385F;
}
body {
margin: 0;
overflow-x: hidden;
}
article, aside, details, figcaption, figure, footer, header, hgroup, main, nav, section, summary {
display: block;
}
a {
background: transparent;
text-decoration: none;
}
a:active, a:hover {
outline: 0;
}
nav ul, nav ol {
list-style: none;
list-style-image: none;
margin: 0;
padding: 0;
}
h1, h2, h3, h4 {
margin: 0;
padding: 0;
border: 0;
vertical-align:baseline;
font-family:'Open Sans', sans-serif;
}
* {
box-sizing:border-box;
-moz-box-sizing:border-box;
}
#menu a {
text-decoration: none;
}
#menuWrapper {
display: block;
text-align: center;
margin: 15px auto 15px;
}
#menu {
display:inline-block;
clear:both;
height:auto;
-webkit-box-shadow: 0px 9px 10px -9px rgba(35, 35, 35, 0.8);
-moz-box-shadow: 0px 9px 10px -9px rgba(35, 35, 35, 0.8);
box-shadow: 0px 9px 10px -9px rgba(35, 35, 35, 0.8);
}
#menu ul {
margin:0;
}
#menu li {
float:left;
position:relative;
}
#menu > ul > li > a {
padding:25px 19px 20px;
border-bottom:3px solid transparent;
margin-right:0px;
color:#6D6E70;
font: 1em'Open Sans', sans-serif;
font-weight:bold;
text-align:center;
text-transform: uppercase;
display:block;
line-height: .4em;
}
#menu > ul > li:last-child > a {
font-size: 1em;
}
#menu > ul > li:hover > a {
color:#5999db;
border-bottom: 3px solid #5999db;
}
#menu > ul li.selected > a, #menu > ul li.selected:hover > a {
color:#3F9944;
border-color:#FFF100;
}
/* Submenu (second level) */
#menu li > .wrapp > ul {
position:absolute;
top:auto;
left:0;
width:180px;
max-height:0;
/* -webkit-box-shadow: 0px 2px 7px 1px rgba(0, 0, 0, 0.4);
-moz-box-shadow: 0px 2px 7px 1px rgba(0, 0, 0, 0.4);
box-shadow: 0px 2px 7px 1px rgba(0, 0, 0, 0.4); */
visibility: none;
z-index:99999;
overflow:hidden;
-webkit-transition: max-height 0.2s ease, visibility 0s linear 0.5s;
-moz-transition: max-height 0.2s ease, visibility 0s linear 0.5s;
-o-transition: max-height 0.2s ease, visibility 0s linear 0.5s;
-ms-transition: max-height 0.2s ease, visibility 0s linear 0.5s;
transition: max-height 0.2s ease, visibility 0s linear 0.5s;
background: inherit !important;
}
#menu ul li:hover ul {
visibility: visible;
max-height: 330px;
width: 204px;
transition-delay: 0s;
overflow: visible;
border: 1px solid #EEE;
border-top: 0;
}
#menu ul li > ul:hover {
overflow:visible;
}
#menu li > ul li {
height:36px;
width:100%;
border-bottom: 1px solid #EEE;
padding-top:0;
font-weight: 600;
background-color: #13385F;
color: #FFF;
opacity: 1;
}
#menu li > ul li:last-child {
border-bottom:none;
height: 35px;
}
#menu li > ul li a {
background: rgba(19, 57, 95, 0.3);
padding: 11px 15px;
height: 35px;
color: #FFF;
width: 100%;
font: 10px'Open Sans', sans-serif;
font-weight: bold;
text-align: left;
text-transform: uppercase;
display: block;
opacity: 1;
}
#menu li > ul li:hover > a {
color: #3B3B3B;
background: #5999db;
}
#menu li > ul li.selected > a, #menu li > ul li.selected:hover > a {
color: #3B3B3B;
background: #FFF;
}
ul.twinsub {
clear: both;
display: inline-block;
width:408px !important;
border-right: none !important;
background-color: #5d6f82 !important;
overflow: hidden;
}
ul.twinsub > li {
display: inline-block;
border-top: none !important;
background: #FFF;
line-height: 38px;
}
li.twinmultisub {
display: block;
width: 50% !important;
}
.menuimage {
width: 100% !important;
margin-left: 1px;
border-right: none;
line-height: 0 !important;
font-size: 0 !important;
}
li.twinimg {
float: left;
border: none;
}
li.twinimg section {
line-height: 0;
}
.borderleft {
border-left: 1px solid #EEE;
}
li.twinleft {
clear: both;
float: left;
border-right: none !important;
}
li.twinheader {
width: 50% !important;
text-align: left;
padding-left: 14px;
font-size: .9em;
background-color: #5d6f82 !important;
color: #FFF;
opacity: 1;
}
<section id="menuWrapper">
<nav id="menu" class="cf" role="navigation">
<!-- Main Nav Start -->
<ul id="main-nav" class="clearfix">
<!----------------------------------------- Solutions ------------------>
<li id="technology" class="parent menu-item">Solutions
<div class="wrapp">
<ul class="twinsub">
<li class="twinmultisub twinleft">
<ul>
<li id="solutions-turnkey" class="menu-item">Turnkey Development
</li>
<li id="solutions-financing" class="menu-item">Financial Modeling
</li>
<li id="solutions-execution" class="menu-item">World-Class Execution
</li>
</ul>
</li>
<li class="twinmultisub twinimg">
<section>
<img class="menuimage" src="http://milkytech.com/images/industry.png" />
</section>
</li>
</ul>
</div>
</li>
<li id="technology" class="parent menu-item">Services
<div class="wrapp">
<ul class="twinsub">
<li class="twinmultisub twinleft">
<ul>
<li id="services-devlopment" class="menu-item">Development & Financing
</li>
<li id="services-design" class="menu-item">Design & Engineering
</li>
<li id="services-construction" class="menu-item">Construction & Procurement
</li>
<li id="services-operations" class="menu-item">Operations & Maintenance
</li>
<li id="services-construction" class="menu-item">Construction & Procurement
</li>
<li id="services-operations" class="menu-item">Operations & Maintenance
</li>
</ul>
</li>
<li class="twinmultisub twinimg">
<section>
<img class="menuimage" src="http://milkytech.com/images/industry.png" />
</section>
</li>
</ul>
</div>
</li>
</ul>
</nav>
</section>
Just remeber to fix the css on the menu. And the section around the image, and the image itself needs a line-height of 0.
I've got a menu made that utilizes left and right borders to separate each menu item. When hovering over the menu, the background changes to a lighter shade, which is what I want. However, hovering also covers the left border. How can I stop the border from disappearing? I'm sure this has been answered elsewhere, but I couldn't find it. Thanks, in advance.
http://jsfiddle.net/aYsKp/2/
HTML:
<div id="header">
<div id="menu">
<ul>
<li>HOME
</li>
<li>PRODUCTS
</li>
<li>VIDEOS
</li>
<li>DOWNLOADS
</li>
<li>CONTACT
</li>
<li>ABOUT
</li>
</ul>
</div>
</div>
CSS:
#header {
width:960px;
margin: 10px auto 5px auto;
background-color: #727272;
}
#menu {
max-width:828px;
bottom:0;
right:0;
font: 12px/18px sans-serif;
}
#menu a {
text-decoration: none;
display:block;
padding: 10px 32px;
color:#FFF;
}
#menu ul {
text-align: left;
display: inline;
margin: 0;
padding: 15px 4px 17px 0;
list-style: none;
}
#menu ul li {
display: inline-block;
margin-right: -4px;
position: relative;
cursor: pointer;
-webkit-transition: all 0.2s;
-moz-transition: all 0.2s;
-ms-transition: all 0.2s;
-o-transition: all 0.2s;
transition: all 0.2s;
border-right: 1px solid #FFF;
}
#menu ul li:first-child {
border-left: 1px solid #FFF;
}
#menu ul li:hover {
background-color:#818181;
}
Try this approach.
#header {
width:960px;
margin: 10px auto 5px auto;
}
#menu {
max-width:828px;
bottom:0;
right:0;
font: 12px/18px sans-serif;
background-color: white;
}
#menu a {
text-decoration: none;
display:block;
padding: 10px 32px;
color:#FFF;
}
#menu ul {
text-align: left;
display: inline;
margin: 0;
padding: 15px 4px 17px 0;
list-style: none;
}
#menu ul li {
display: inline-block;
position: relative;
cursor: pointer;
-webkit-transition: all 0.2s;
-moz-transition: all 0.2s;
-ms-transition: all 0.2s;
-o-transition: all 0.2s;
transition: all 0.2s;
background-color: #727272;
margin:0;
}
#menu ul li:hover {
background-color:#818181;
}
What I've done is just removed right margin and specified background color as white for the menu div.
I use to set border or space informations in A tag, not in LI, making LI like an "invisible" tag, setting all properties to A, using A display:inline-block.
I'm having trouble creating the third level fligh out for a horizontal css menu. I've tried many different changes to the css to no avail. I have included the menu html and the css. What changes do I need to make to the css to have it work?
When 'ADD SCORES' is hovered over the 2 menus should show to the right
#menu {
background-color: #66A366;
padding: 6px 0 6px 20px;
}
#menu ul li a {
color: #fff;
text-decoration: none;
font-family:"Arial Narrow", "Myriad Pro";
}
#menu li {
color: #fff;
text-decoration: none;
font-family:"Arial Narrow", "Myriad Pro";
}
ul {
text-align: left;
display: inline;
margin: 0;
padding: 15px 4px 17px 0;
list-style: none;
-webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
-moz-box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
}
ul li {
font: bold 14px/18px sans-serif;
display: inline-block;
margin-right: -4px;
position: relative;
padding: 15px 20px;
background: #66A366;
cursor: pointer;
-webkit-transition: all 0.2s;
-moz-transition: all 0.2s;
-ms-transition: all 0.2s;
-o-transition: all 0.2s;
transition: all 0.2s;
}
ul li:hover {
background: #555;
color: #fff;
}
ul li ul {
padding: 0;
position: absolute;
top: 48px;
left: 0;
width: 150px;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
display: none;
opacity: 0;
z-index:1000;
visibility: hidden;
-webkit-transiton: opacity 0.2s;
-moz-transition: opacity 0.2s;
-ms-transition: opacity 0.2s;
-o-transition: opacity 0.2s;
-transition: opacity 0.2s;
}
ul li ul li {
background: #555;
display: block;
color: #fff;
text-shadow: 0 -1px 0 #000;
}
ul li ul li:hover {
background: #666;
}
ul li:hover ul {
display: block;
opacity: 1;
visibility: visible;
}
ul li ul li:hover li{
display: block;
opacity: 1;
visibility: visible;
}
ul li ul li ul li{
padding: 15px 20px;
font: bold 14px/18px sans-serif;
display: none;
position: relative;
top: -48px;
left: 154px;
width: 120px;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
opacity: 0;
z-index:1000;
visibility: hidden;
-webkit-transiton: opacity 0.2s;
-moz-transition: opacity 0.2s;
-ms-transition: opacity 0.2s;
-o-transition: opacity 0.2s;
-transition: opacity 0.2s;
}
<div id="menu">
<ul>
<li>SCORES
<ul>
<li>ADD SCORES
<ul>
<li>Level 3-A-1</li>
<li>Level 3-A-2</li>
</ul>
</li>
<li>EDIT SCORES</li>
</ul>
</li>
<li>PLAYERS
<ul>
<li>ADD PLAYER</li>
<li>EDIT PLAYERS</li>
</ul>
</li>
<li>COURSES
<ul>
<li>ADD COURSE</li>
<li>EDIT COURSES</li>
</ul>
</li>
<li>ADMIN</li>
</ul>
</div>
Demo FIDDLE
I'm not sure how you want your menu to look like, but I noticed that you forgot to wrap the tabs inside a <ul></ul> tag.
If you do that, the menu will look and behave like what most users would expect.
<div id="menu">
<ul> <-- here
<li>SCORES
// some code
<li>ADMIN</li>
</ul> <-- and here
</div>
You can save your time using Swimbi - Swift Menu Builder
- http://f-source.com/swimbi/
have a look at menu demo
When i hover over the navmenu it pushes other content down on the webpage. In addition, when you hover over the nav the font is no longer in white. I'm sorry I am new at programming and borrowed some of this code so it may be sloppy. Thanks
Here is my html:
<div class="nav">
<ul id="nav">
<li>Home</li>
<li>Shop Online</li>
<li>Online Rentals
<div>
<ul>
<li>Rent Now</li>
<b>Current Rental Customers</b>
<li>Rental Returns</li>
<li>Rental Repairs</li>
<li>Rental Exchanges</li>
</ul>
</div>
</li>
<li>Lessons
<div>
<ul>
<li>Private Lessons</li>
<li>Meet the Teachers</li>
<li>Request a Lesson</li>
</ul>
</div>
</li>
<li>Performing Arts Center
<div>
<ul>
<li>Musical Theater</li>
<li>Kindermusik</li>
<li>Recording Studio</li>
<li>Group Ensembles</li>
</ul>
</div>
</li>
<li>Repairs</li>
<li>My Account</li>
</ul>
</div>
Here is my css:
/* main menu styles */
#nav,#nav ul {
font-family: verdana;
list-style: none;
margin: 0;
padding: 0;
position: fixed;
}
#nav {
height: 50px;
left: 0;
overflow: hidden;
top: 0;
position: relative;
}
#nav li {
float:left;
position:relative;
z-index:10;
}
#nav li a {
background-repeat: no-repeat;
background-position: center top;
color: #fff;
display: inline;
float: left;
font-size: 14px;
height: 51px;
line-height: 40px;
padding: 0 10px;
position: relative;
text-decoration: none;
z-index: 20;
background-color: #005E20;
}
#nav li:first-child a {
background:url(file:///Macintosh%20HD/Users/davidscott/Downloads/example91/images/bg-menu.png) no-repeat left top;
padding-left:35px;
}
#nav li ul li:first-child a {
background-image:none;
padding-left:10px;
}
#nav li.pad {
background: url(file:///Macintosh%20HD/Users/davidscott/Downloads/example91/images/bg- menu.png) no-repeat right top;
display: inline;
height: 51px;
width: 35px;
}
#nav ul {
background-color: #FFFFFF;
height: auto;
padding: 10px 0;
position: absolute;
top: -115px;
width: 180px;
z-index: 1;
border-radius: 8px; /*some css3*/
-moz-border-radius: 8px;
-webkit-border-radius: 8px;
transition: 0.8s ease-in-out;
box-shadow: 2px 2px 3px rgba(0, 0, 0, 0.5);
-moz-box-shadow: 2px 2px 3px rgba(0, 0, 0, 0.5);
-webkit-box-shadow: 2px 2px 3px rgba(0, 0, 0, 0.5);
-moz-transition: 0.8s ease-in-out;
-o-transition: 0.8s ease-in-out;
-webkit-transition: all 0.8s ease-in-out;
color: #005E20;
}
#nav ul li {
width:180px;
}
#nav ul li a {
background:transparent;
height:20px;
line-height:20px;
width:160px;
}
#nav:hover {
height:200px;
}
#nav li:hover ul {
-moz-transform:translate(0,161px); /*some css3*/
-o-transform:translate(0,161px);
-webkit-transform:translate(0,161px);
}
#nav a:hover,#nav li:hover > a {
color:#99ff33;
}
This changes the height of the nav on hover (pushing the rest of the page down):
#nav:hover {
height:200px;
}
This changes the color to green on hover:
#nav a:hover, #nav li:hover > a {
color:#99ff33;
}
Here's a rudimentary example without those hover definitions:
http://jsfiddle.net/w4uyX/
It's all in your CSS code (which seems a bit unorganized to me).
To deal with the menu pushing other content down, please find the selector #nav:hover where a larger height is set.
Then find the selector #nav a:hover,#nav li:hover > a. There is the setting for the different color, when you hover over the menu.
see my navbar and see the difference
http://codepen.io/leandroruel/pen/yrwKI
So basically I have a simple menu that is not displaying correctly in IE at all.
Have visited another few posts that has this same problem, although they didn't seem to work.
Here is my HTML:
<div id="topnav">
<ul>
<li>Car Sales</li>
<li>Boat Sales</li>
<li>Caravan Sales</li>
<a href="#" title="Truck Sales"><li>Truck Sales</li><a>
<li>Equipment Sales</li>
<li>Bike Sales</li>
</ul>
</div>
Here is my CSS:
#topnav
{
text-align:center;
width:100%;
background-color:#ffffff;
}
#topnav ul a li
{
display:inline-block;
font: 12px/18px sans-serif;
color:#000000;
}
#topnav ul {
width:100%;
text-align: left;
display: inline;
margin: 0;
padding: 0px;
list-style: none;
}
#topnav ul li {
font: bold 12px/18px sans-serif;
display: inline-block;
margin-right: -4px;
position: relative;
padding: 5px 20px;
background: #fff;
cursor: pointer;
-webkit-transition: all 0.2s;
-moz-transition: all 0.2s;
-ms-transition: all 0.2s;
-o-transition: all 0.2s;
transition: all 0.2s;
-webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
-moz-box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
}
#topnav ul li:hover {
background: #555;
color: #fff;
}
#topnav ul li a:hover{ color:#ffffff; }
#topnav ul li ul {
padding: 0;
position: absolute;
top: 48px;
left: 0;
width: 150px;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
display: none;
opacity: 0;
visibility: hidden;
-webkit-transiton: opacity 0.2s;
-moz-transition: opacity 0.2s;
-ms-transition: opacity 0.2s;
-o-transition: opacity 0.2s;
-transition: opacity 0.2s;
}
#topnav ul li ul li {
background: #555;
display: block;
color: #fff;
text-shadow: 0 -1px 0 #000;
}
#topnav ul li ul li:hover { background: #666; }
#topnav ul li:hover ul {
display: block;
opacity: 1;
visibility: visible;
}
JSfiddle:
http://jsfiddle.net/menEk/1/
All help and suggestions would be greatly appreciated.
Your HTML code is wrong!
try it:
<ul>
<li>Car Sales</li>
<li>Boat Sales</li>
<li>Caravan Sales</li>
<li><a href="#" title="Truck Sales">Truck Sales<a></li>
<li>Equipment Sales</li>
<li>Bike Sales</li>
</ul>
and
#topnav ul li a
{
display:inline-block;
font: 12px/18px sans-serif;
color:#000000;
}
Tha a tag should be in li tag!
If you gave #topnav an exact width such as 100px and gave each li in it a width of 100% they would be forced to align vertically.
I have made a JS Fiddle to show it.
Changed css widths have:
/* CHANGED */
above them.
http://jsfiddle.net/menEk/2/