Dropdown menu disappears in IE8 - html

I am working on a dropdown meenu, which is disappearing in IE 8. Works fine in firefox and chrome, but not in IE8. i googled for two days and made many changes but still not working in IE. Here is the code for CSS.
.dropdownmenu li, .dropdownmenu li ul
{
display: block;display:inline;float:none;
}
dropdownmenu ul:hover , .dropdownmenu ul li:hover
{
display: block;display:inline; float:none;
}
.dropdownmenu{
border:none;
border:0px;
margin:0px;
padding:0px;
font: 37.5% "Lucida Sans Unicode", "Bitstream Vera Sans", "Trebuchet Unicode MS", "Lucida Grande", Verdana, Helvetica, sans-serif;
font-size:14px;
font-weight:bold;
color:#ffffff;
}
.dropdownmenu ul{
background:#333333;
height:35px;
list-style:none;
margin:0;
padding:0;
}
.dropdownmenu li a.top_link span {color:#ffffff;font-size:11px;}
.dropdownmenu li{
color: #FFFFFF;
font-size:11px;
float:left;
padding:0px;
}
.dropdownmenu li a{
background:#333333 url("dropdown/seperator.gif") bottom right no-repeat;
color:#ffffff;
display:block;
font-weight:normal;
line-height:35px;
margin:0px;
padding:0px 11px;
text-align:center;
text-decoration:none;
}
.dropdownmenu li a:hover{
background: #2580a2 url("dropdown/hover.gif") bottom center no-repeat;
color:#FFFFFF;
text-decoration:none;
}
.dropdownmenu li ul{
color:#ffffff;
font-size:10px;
background:#333333;
display:none;
height:auto;
padding:0px;
margin:0px;
border:0px;
position:absolute;
width:auto;
z-index:200;
/*top:1em;
left:0;*/
}
.dropdownmenu li:hover ul{
display:block;
float:left;
}
.dropdownmenu li li {
background:url('dropdown/sub_sep.gif') bottom left no-repeat;
display:block;
float:none;
margin:0px;
padding:0px;
width:auto;
}
.dropdownmenu li ul a{
display:block;
height:35px;
font-size:12px;
color:#ffffff;
font-style:normal;
margin:0px;
padding:0px 10px 0px 17px;
text-align:left;
}
.dropdownmenu li ulli a:hover{
display:block;
background:#2580a2;
color:#ffffff;
text-decoration:none;
}
Here is the php code, I have used <?include ('dropdown.php')?> on my site to include this in the CMS built website.
<link rel="stylesheet" href="dropdown/dropdown3.css" type="text/css" />
<ul class="dropdownmenu">
<li ><span>Home & Garden <img src="dropdown/down.gif"></span>
<ul class="sub">
<li>ArtWork</li>
<li>Bedding & Bath</li>
<li>Kitchen & Dining</li>
<li>Patio, Lawn & Garden</li>
<li>Pet Supplies</li>
<li>Sewing, Craft & Hobbies</li>
<li>Vacuum, Cleaning & Storage </li>
</ul>
</li>
</ul>
What else can i do to fix it in IE?
Also, when the dropdown menu is hovered, it shows a background color of #2580a2, which can be seen at .dropdownmenu li a:hover This particular thing is not being shown in chrome. What could be the reason?

Using Internet Explorer Compatibility View on that website may help it display properly. Try it.

I'm using jQuery Dropdown for this with no errors at any browser.
If your menu will work well Explorer Compatibility View as "Sagotharan" suggested you can override IE rendering engine by setting it to render as IE7 always, like so
<meta http-equiv="X-UA-Compatible" content="IE=7" />

Related

Drop menu misbehaving. Possibly z-index?

I have two drop menus. the "choose a state" menu and "select a carrier" menu. Here's the thing: I want my drop menus to behave like my "state" menu, in that it moves content below it downwards. However, I want them to look like my "carrier" menu, in that it looks like two separate menus when you click on it. Here is my fiddle for code reference: http://jsfiddle.net/SteveSerrano/rc7fhhhu/
Note: The only difference between the two menus is that "state" is positioned "relative" with a z-index of 9999. "carrier" is positioned "absolute" with a z-index of 9999. I'm lost. Need any help. Thanks :)
<div class="state_box">
<input type="checkbox" id="state-tgl" onblur="closeMenu(this)">
<label id="state-tgl-label" for="state-tgl">
<span class="collapse_tiny">Choose a state</span>
<span class="collapse expand_tiny inline">State</span>
<img src="/images/template2014/dropdown-black.svg" style="vertical-align:middle; width:10px;">
</label>
<ul id="state_drop-menu">
<li><span class="collapse_tiny">Connecticut</span></li>
<li><span class="collapse_tiny">New Hampshire</span></li>
<li><span class="collapse_tiny">New Jersey</span></li>
<li><span class="collapse_tiny">New York</span></li>
</ul>
<div class="carrier_box">
<input type="checkbox" id="carrier-tgl" onblur="closeMenu(this)">
<label id="carrier-tgl-label" for="carrier-tgl">
<span class="collapse_tiny">Select a carrier</span>
<span class="collapse expand_tiny inline">State</span>
<img src="/images/template2014/dropdown-black.svg" style="vertical-align:middle; width:10px;">
</label>
<ul id="carrier_drop-menu">
<li><span class="collapse_tiny">Carrier 1</span><span class="collapse expand_tiny inline">Conn.</span></li>
<li><span class="collapse_tiny">Carrier 2</span><span class="collapse expand_tiny inline">N.H.</span></li>
<li><span class="collapse_tiny">Carrier 3</span><span class="collapse expand_tiny inline">N.J.</span></li>
<li><span class="collapse_tiny">Carrier 4</span><span class="collapse expand_tiny inline">N.Y</span></li>
</ul>
CSS CODE:
.state_box{
margin-bottom:-9px;
background-color:rgba(6, 0, 0, 0.09);
padding-left:10px;
padding-right:10px;
padding-bottom:7px;
padding-top:15px;
width:160px;
}
.state_box ul{
margin:0;
padding:0;
list-style-type: none;
}
.state_box ul li{
display:inline;
}
.state_box ul ul{
display:inline;
}
.state_box ul li a{
text-decoration:none;
padding-left:16px;
color:#000;
font-family:'Raleway', Arial, Helvetica, sans-serif;
font-weight:500;
font-size:23px; font-size:2.3rem;
text-transform:uppercase;
vertical-align:-8px;
color:#939598;
}
.state_box ul li a.first_state{
padding-left:0px;
}
.state_box ul li .third_level{
color:#a7a9ac;
font-size:18px; font-size:1.8rem;
vertical-align:-5px;
}
.state_box ul li .fourth_level{
color:#BCBEC0;
font-size:14px; font-size:1.4rem;
vertical-align:-3px;
}
.state_box ul li a:hover{
color:#808285;
}
.state_box ul li .selected_state{
font-size:36px; font-size:3.6rem
color:#000000;
text-transform:uppercase;
vertical-align:text-top;
color:#000;
font-family:'Raleway', Arial, Helvetica, sans-serif;
}
#state-tgl{
position:absolute;
/* IE 8 */
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
/* Real Browsers */
opacity:0;
}
#state-tgl-label{
font-size:28px; font-size:1.8rem;
color:#000000;
font-family:'Raleway', Arial, Helvetica, sans-serif;
/*font-weight:500;*/
display:block;
}
#state-tgl-label img{
float:right;
margin-top:5px;
}
#state_drop-menu{
position:relative;
z-index:9999;
background-color:rgba(6, 0, 0, 0.09);
/*border:solid 2px black;*/
width:200px;
padding-top:8px;
padding-bottom:8px;
display:none;
max-height:0px;
transition: max-height 0.25s ease;
margin-left:-10px;
margin-top:10px;
}
#state_drop-menu li{
display:block;
padding:0px;
margin:0px;
width:100%;
}
#state_drop-menu li a{
font-size:36px; font-size:1.8rem;
color:black;
padding:0px;
margin:0px;
display:block;
padding-left:8px;
padding-right:8px;
}
#state_drop-menu li a:hover{
color:white;
background-color:black;
}
#state-tgl:checked ~ #state_drop-menu{
display:block;
max-height:1000px;
}
/*########### Carrier Drop Menu ############*/
.carrier_box{
margin-bottom:-9px;
background-color:rgba(6, 0, 0, 0.09);
padding-left:10px;
padding-right:10px;
padding-bottom:7px;
padding-top:15px;
width:320px;
}
.carrier_box ul{
margin:0;
padding:0;
list-style-type: none;
}
.carrier_box ul li{
display:inline;
}
.carrier_box ul ul{
display:inline;
}
.carrier_box ul li a{
text-decoration:none;
padding-left:16px;
color:#000;
font-family:'Raleway', Arial, Helvetica, sans-serif;
font-weight:500;
font-size:23px; font-size:2.3rem;
text-transform:uppercase;
vertical-align:-8px;
color:#939598;
}
.carrier_box ul li a.first_carrier{
padding-left:0px;
}
.carrier_box ul li .third_level{
color:#a7a9ac;
font-size:18px; font-size:1.8rem;
vertical-align:-5px;
}
.carrier_box ul li .fourth_level{
color:#BCBEC0;
font-size:14px; font-size:1.4rem;
vertical-align:-3px;
}
.carrier_box ul li a:hover{
color:#808285;
}
.carrier_box ul li .selected_carrier{
font-size:36px; font-size:3.6rem
color:#000000;
text-transform:uppercase;
vertical-align:text-top;
color:#000;
font-family:'Raleway', Arial, Helvetica, sans-serif;
}
#carrier-tgl{
position:absolute;
/* IE 8 */
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
/* Real Browsers */
opacity:0;
}
#carrier-tgl-label{
font-size:28px; font-size:1.8rem;
color:#000000;
font-family:'Raleway', Arial, Helvetica, sans-serif;
/*font-weight:500;*/
display:block;
}
#carrier-tgl-label img{
float:right;
margin-top:5px;
}
#carrier_drop-menu{
position:absolute;
z-index:9999;
background-color:rgba(6, 0, 0, 0.09);
/*border:solid 2px black;*/
width:320px;
padding-top:8px;
padding-bottom:8px;
display:none;
max-height:0px;
transition: max-height 0.25s ease;
margin-left:-10px;
margin-top:10px;
}
#carrier_drop-menu li{
display:block;
padding:0px;
margin:0px;
width:100%;
}
#carrier_drop-menu li a{
font-size:36px; font-size:1.8rem;
color:black;
padding:0px;
margin:0px;
display:block;
padding-left:8px;
padding-right:8px;
}
#carrier_drop-menu li a:hover{
color:white;
background-color:black;
}
#carrier-tgl:checked ~ #carrier_drop-menu{
display:block;
max-height:1000px;
}
#charts{
margin-top:50px;
}
This should be a good start: move your background-color from .state-box and move it onto:
#state-tgl-label {
background-color:rgba(6, 0, 0, 0.09);
}
That way only the label gets the background color, and not the whole surrounding div. The reason you need to keep position: relative is that using position: absolute takes it out of the flow of the document, which prevents your desired effect of moving the other elements of the page down when opened.
Here's a quick fiddle: http://jsfiddle.net/rc7fhhhu/1/
updated fiddle: http://jsfiddle.net/rc7fhhhu/2/
I've removed margin-left: -10px from the ul element, and moved the padding onto the #state-tgl-label element. Should be pretty close to what you were looking for.

Div width making "special" moves in Chrome

I have made a nav section with a couple of dropdown buttons.
I would like to set the width of the div's by the text lenght.
I tought I did a pretty good job, according to the result in Firefox. (the exact result I would like)
However, checking the site in Chrome, the whole nav section is completely reacting different.
The text is breaking up, div width isn't right anymore.
But the strangest thing is that when I hover on the buttons, the div width's start to react and changing to the right settings.
Is this a Chrome thing, or do I need to make my code on different way?
I'm using normalize.css in my parent css file.
This is the website: http://callensdecor.be/preview/
HTML:
<nav>
<ul>
<li><a class="selected" href="index.html">Home</a></li>
<li>Onze diensten
<ul>
<li>Schilderwerken</li>
<li>Totaalwerken</li>
<li>Andere werken</li>
</ul>
</li>
<li>Over ons</li>
<li>Contact</li>
</ul>
</nav>
CSS:
nav{
float:right;
padding-top:68px;
}
nav ul{
position: relative;
display: inline-table;
width:100%;
}
nav ul:after {
content: ""; clear: both; display: block;
}
nav li{
float:left;
list-style-type:none;
margin-right:2%;
}
nav ul li a{
display:block;
width:auto;
min-width:75px;
text-align:center;
background-color:#E9E9E9;
color:#555555;
padding:7px 13% 10px;
border-radius:50px;
font-family:"Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", "DejaVu Sans", Verdana, sans-serif;
font-size:16px;
text-decoration:none;
}
nav li a:hover, .selected{
background-color:#838383;
color:white;
text-decoration:none;
}
nav ul ul {
display: none;
border-radius: 0px;
padding: 0;
position: absolute;
top: 35px;
width:auto;
margin-left:0%;
}
nav ul li:hover > ul {
display: block;
}
nav ul ul li {
float: none;
position: relative;
}
nav ul ul li a {
color:#555555;
background-color:#E9E9E9;
margin-top:3px;
width:auto;
}
nav ul ul li a:hover {
background: #838383;
color:white;
text-decoration:none;
}
In my Google Chrome this works:
jsfiddle <-- See the jsfiddle
It look's like the padding in the nav ul li a{ is messing it up for you.
As the other answer said it's the 13% padding here:
nav ul li a{
display:block;
width:auto;
min-width:75px;
text-align:center;
background-color:#E9E9E9;
color:#555555;
padding:7px 13% 10px;
border-radius:50px;
font-family:"Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", "DejaVu Sans", Verdana, sans-serif;
font-size:16px;
text-decoration:none;
}
that is screwing with you change it to a px value and you should be good to go :D

how to get my navigation button stay active

Can't get my navigation to stay active using html and css. It just light up but does not stay active when pressed. What am I missing?
How do I make it stay active when pressed? Really need the help fast! Sorry for my bad code, I'm new to coding.
How do I type the active class? I tried to, but it did not work.
HTML
<div id="apaknavig">
<div id="menu2">
<ul>
<li>Uzņēmums</li>
<li>kontakti</li>
</ul>
</div>
</div>
CSS
#apaknavig {
Width: 200px;
height: 604px;
top:-613px;
position:relative;
font:14px Arial;
color:black;
float:left;
right:35px;
text-indent:12px;
display: block;
line-height:30px;
}
#menu2 ul{
list-style:none;
float: left;
font:14px Arial;
color:black;
right:90px;
text-decoration:none;
text-align:left; width:10px;
display: block;
line-height:30px;
margin-bottom:10px;
}
#menu2 a{
background-image: url(bildes/apak_navig.png);
display:block;
width: 196px;
height:34px;
font:14px Arial;
color:black;
float:left;
right:90px;
text-decoration:none;
display: block;
line-height:30px;
margin-bottom:3px;
}
#menu2 a:hover{
background-image: url(bildes/apak_navig_green.png);
color:white;
font:14px Arial;
color:black;
text-decoration:none;
display: block;
line-height:30px;
}
Just change #menu2 a:hover{ to #menu2 a:hover, #menu2 a:active {.
You just have to add #menu2 a:active to the CSS.
#menu2 a:hover,#menu2 a:active{
background-image: url(bildes/apak_navig_green.png);
color:white;
font:14px Arial;
color:black;
text-decoration:none;
display: block;
line-height:30px;
}
I tried it but it just does not work. It continues to just hover, but does not stay active when I press it.

how to get my navigation button to stay active? [duplicate]

This question already has an answer here:
how to get my navigation button stay active
(1 answer)
Closed 9 years ago.
Can't get my navigation to stay active using html and css. It just light up but does not stay active when pressed. What am I missing?
How do I make it stay active when pressed? Really need the help fast! Im new to coding so please help.
tried changing #menu2 a:hover{ to #menu2 a:hover, #menu2 a:active {.
added #menu2 a:active to the CSS.
#menu2 a:hover,#menu2 a:active{
background-image: url(bildes/apak_navig_green.png);
color:white;
font:14px Arial;
color:black;
text-decoration:none;
display: block;
line-height:30px;
}
But did not work, and when I leave only the active class it just gliches for a seconed in the look I need and then goes back to the old look, I suppose thats because the information is in different html files, but then how can I make it work?
HTML
<div id="apaknavig">
<div id="menu2">
<ul>
<li>Uzņēmums</li>
<li>kontakti</li>
</ul>
</div>
</div>
CSS
#apaknavig {
Width: 200px;
height: 604px;
top:-613px;
position:relative;
font:14px Arial;
color:black;
float:left;
right:35px;
text-indent:12px;
display: block;
line-height:30px;
}
#menu2 ul{
list-style:none;
float: left;
font:14px Arial;
color:black;
right:90px;
text-decoration:none;
text-align:left; width:10px;
display: block;
line-height:30px;
margin-bottom:10px;
}
#menu2 a{
background-image: url(bildes/apak_navig.png);
display:block;
width: 196px;
height:34px;
font:14px Arial;
color:black;
float:left;
right:90px;
text-decoration:none;
display: block;
line-height:30px;
margin-bottom:3px;
}
#menu2 a:hover{
background-image: url(bildes/apak_navig_green.png);
color:white;
font:14px Arial;
color:black;
text-decoration:none;
display: block;
line-height:30px;
}
It's active while clicking, nothing more.
You could use JavaScript to add an "active" class.

CSS: Trying to get a horizontal menu formatted the right way, not consistent accross browsers

I am trying to make a horizontal menu look pretty.
Here's an example of what my HTML looks like.
<div id="menu">
<ul>
<li><a class="selected" href="index.html">Home</a></li>
<li>Bio</li>
<li>Labs</li>
<li>Assignments</li>
</ul>
</div>
This is a snippet from my CSS. It does the job in Firefox but not IE.
#menu {
margin:auto;
padding-top: 4px;
width: 800px;
}
#menu ul
{
float:left;
list-style-type:none;
margin:0;
padding:0;
padding-top:7px;
padding-left:20px;
}
#menu li
{
font: 87.5% "Lucida Sans Unicode", "Bitstream Vera Sans", "Trebuchet Unicode MS", "Lucida Grande", Verdana, Helvetica, sans-serif;
display:inline-block;
}
#menu a, #menu a.selected
{
text-decoration:none;
color:#000;
background-color:#fff;
background-image:url('../images/menu-unselected.jpg');
background-repeat:repeat-x;
padding-top:4px;
padding-bottom:0px;
padding-left:12px;
padding-right:12px;
border:solid;
border-width: 1px 1px 1px 1px;
border-color:#000;
}
#menu a.selected
{
padding-top:7px;
padding-bottom:1px;
border-width: 1px 1px 0px 1px;
}
#menu a:hover, #menu a.selected
{
background-image:url('');
}
I can make changes to the css to get it working right in IE, but then it doesn't work in FireFox! Here's screenshots of the code above rendered in each browser:
Firefox: here
Internet Explorer: here
This worked for me.
On #menu li instead of display:inline; replace it with float:left;
Then on #menu a.selected use padding and margin to reposition it taller than the others. I added:
padding-bottom:4px;
padding-top:7px;
margin-top:5px;
display:block; on #menu a seems optional. I'm on a Mac in FF 7.0.1 and it looks correct. Can't see it in IE. Hope that helps.
i tend to use display:inline-block; instead of float:left; when it's possible, and never had problems cross-browsers. So what i suggest to you is to use #menu li{ display:inline-block;}.
Obviously all changes are relative to your default layout ... wrappers,pages,body,html etc etc ..
Change display: inline-block; to display: inline; in your li.
Then add display: block; float: left; to your a.
You would then change the style of the tabs through the a tag (things such as text-align, width, etc).