开发者

Issue with IE7 display:table in menu

开发者 https://www.devze.com 2023-01-25 18:56 出处:网络
I Wrote a menu style which is working fine in IE8,FF3.6,GC7. Now the problem is, my boss want it to work even on IE7. I really tried hard to make it work on IE7, but unable to get the same look.

I Wrote a menu style which is working fine in IE8,FF3.6,GC7. Now the problem is, my boss want it to work even on IE7. I really tried hard to make it work on IE7, but unable to get the same look.

menu.css

a{outline:none;}

.menu {
margin:0;
display:table;
padding:0;
white-space:nowrap;
width:958px;
text-align:center;
font-size:12px;
font-weight:bold;
font-family: Arial, Helvetica, sans-serif;
height: 30px;
background: transparent url("../images/menubg.jpg") repeat-x top left;
border-bottom:4px solid #92C4E9;
border-right:2px solid #005D91;
border-left:2px solid #005D91;
}
.menu ul {
list-style:none;
margin:0;
padding:0;
display:table-row;
white-space:nowrap;
}
.menu ul li{
display:table-cell;
border-right:1px solid #005D91;
border-left:1px solid #005D91;
}
.menu ul a{
display:block;
padding:12px 5px 0 5px;
text-decoration:none;
height:26px;
margin: 0 3px 0 3px;    
color:#ffffff;  
}
.menu ul a:hover{
margin: 0 3px 0 3px;    
background:transparent url("../images/menubgover.jpg") repeat-x top left;

}
.menu li ul
{   
margin:0px;
padding:0px;
display:none;
position:开发者_StackOverflow社区absolute;
background-color:#15375f;
filter: alpha(opacity=85); 
-moz-opacity:0.85; 
-khtml-opacity: 0.85;
opacity: 0.85;

}
.menu li:hover ul
{
margin:0px;
padding: 15px 15px 0px 20px;
text-align:left;
line-height:0px;
display:block;
color:#fff;
}
.menu li li
{
list-style:none;
display:list-item;
border-right:0px;
border-left:0px;
padding:0px;
}
.menu li li a
{color:#92C4E9; text-decoration:none; padding:0; margin:0px; font-weight:normal;
}
.menu li li a:hover
{color:#92C4E9; text-decoration:underline; background:none; padding:0; margin:0px; font-weight:normal;}

.present{margin: 0 3px 0 3px;background:transparent url("../images/menubgover.jpg") repeat-x top left;}


IE7 doesn't support display:table, so you have to rebuild the menu in a different way.


Unfortunately, the refusal of IE to support display: table et al is the main cause of most CSS layout hack out there. It's really sad how one company has been holding back web development progress =(

edit: an alternative might be to use display: table for all sane browsers and a clearfix hack for IE. You could of course just use clearfix for all browsers, but display: table etc renders much faster.


Ie8 actually doesn't support any of the table display properties only firefox and a few other browsers do

http://www.w3schools.com/css/pr_class_display.asp

I would just try using display:block


I would suggest to use display:inline-block

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号