Does anybody know an easy fix for this button issue in IE 7? if you look at it in IE 7 the buttons are not aligned correctly and the rollovers don't work.
Does anybody know an easy fix for this button issue in IE 7? if you look at it in IE 7 the buttons are not aligned correctly and the rollovers don't work.
The CSS posted by points to the usual IE7 culprits: anchors that are both floated and declared display:inline, nested floated spans with negative margins, and sprite rollovers that depend on hover areas that may not cover the floated parts. seeing it "fine" on their machine strongly suggests an environment difference (doctype/compatibility mode or an IE7-standalone vs IE8/9 in IE7 mode issue), not necessarily a universal bug in the CSS.
A pragmatic set of fixes that works in IE7 without re-architecting the markup:
:hover across the whole button. This can be done by making the anchor inline-block and forcing hasLayout in IE7:span.button a {
display:inline-block;
*display:inline; /* IE6/7 inline-block hack */
zoom:1; /* triggers hasLayout in IE7 */
} span.button { position:relative; }
span.button a span.right { position:absolute; right:0; top:0; } Troubleshooting checklist (quick, targeted checks):
Note: IE7 has many layout quirks; these fixes are aimed at retaining the current markup while restoring hover coverage and alignment. If full modern compatibility is an option, switching to simpler block/absolute layouts (or dropping IE7 support) will remove most of these special-case fixes.
Jump to Post— Member #120589Took the time to check it and it looks fine to me in Chrome and IE7.
Here is the CSS code for the button.
span.button a {
background:url("images/button.png") no-repeat scroll left top transparent;
float:left;
font:bold 16px/22px Arial,Helvetica,sans-serif;
margin:0;
padding:8px 0 10px 20px;
text-align:left;
text-shadow:0 1px 0 #DEEF97;
text-transform:uppercase;
width:auto;
display:inline;
color:#2d91db;
}
span.button a span.right {
padding:2px 45px 10px 0;
text-align:left;
text-shadow:0 1px 0 #DEEF97;
text-transform:uppercase;
background:url("images/button.png") no-repeat scroll right top transparent;
float:right;
height:29px;
margin:-8px -45px -9px 60px;
}
#main span.button a {
background:url("images/button-content.png") no-repeat scroll left top transparent;
float:left;
font:bold 16px/22px Arial,Helvetica,sans-serif;
margin:0;
padding:8px 0 10px 20px;
text-align:left;
text-shadow:0 1px 0 #DEEF97;
text-transform:uppercase;
width:auto;
color:#ffffff;
}
#main span.button a:hover {
color:#ffffff !important;
}
#main span.button a span.right {
padding:2px 45px 10px 0;
text-align:left;
text-shadow:0 1px 0 #DEEF97;
text-transform:uppercase;
background:url("images/button-content.png") no-repeat scroll right top transparent;
float:right;
height:29px;
margin:-8px -45px -9px 60px;
}
#main span.button a:hover, span.button a:hover {background-position:left bottom; }
#main span.button a:hover span.right, span.button a:hover span.right {background-position:right -42px;}
Took the time to check it and it looks fine to me in Chrome and IE7.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.