SimpleSi Posted December 16, 2006 Posted December 16, 2006 I don't if anyone here can help but found some code on net to use CSS to produce a CMS type link which I quite liked but it renders differently in Firefox from IE - can anyone help me display it left aligned in both browsers? Click on the links below for our opening dates <br /> <!--<br /> a:visited {<br /> text-decoration:none; <br /> text-align:left;<br /> background-color:#FFDE08; <br /> color:#000000; <br /> display:block; <br /> width:50%; <br /> border:2px solid #fff;<br /> border-color:#def #678 #345 #cde;<br /> padding:0.25em;<br /> margin:0.5em auto;<br /> }<br /> a:link {<br /> text-decoration:none; <br /> text-align:left;<br /> background-color:#FFDE08; <br /> color:#000000; <br /> display:block; <br /> width:50%; <br /> border:2px solid #fff;<br /> border-color:#def #678 #345 #cde;<br /> padding:0.25em;<br /> margin:0.5em auto;<br /> }<br /> <br /> a:hover {<br /> top:2px;<br /> left:2px;<br /> color:#000000;<br /> border-color:#345 #cde #def #678;<br /> }<br /> //--><br /> [b]Click on the links below for our opening dates[/b] [b]This school year (Sep 2006- Jul 2007)[/b] [b]Next school year (Sep 2007 - Jul 2008)[/b] regards Simon PS or point me off to the equivalent of here for web coding
webman Posted December 16, 2006 Posted December 16, 2006 It's the margin:0.5em auto; on a:visited and a:link that is aligning it in the middle (the auto is being applied to the left and right margins and 0.5em to the top and bottom). Just remove the 'auto' bit.
SimpleSi Posted December 16, 2006 Author Posted December 16, 2006 @craig Ta very much Do you know why the browsers treat it so differently (and which one is doing it "right" (or is it neither!) ) regards Simon
Geoff Posted December 16, 2006 Posted December 16, 2006 firefox is standards compliant, IE isn't. IE also has several CSS and DHTML bugs. Here's a site listing and demoing them: http://www.positioniseverything.net/explorer.html Generally the way to work round this is to detect the browser version and serve two versions of code (one for IE, one for everybody else).
webman Posted December 16, 2006 Posted December 16, 2006 I agree with everything Geoff says. There are also "workarounds" or "hacks" that you can do in CSS to aim certain attributes to certain browsers. For example you can enclose a style directive by comments that one browser will ignore and another won't.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now