By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,494 Members | 1,957 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,494 IT Pros & Developers. It's quick & easy.

<div> and browser detect problem I'm having with Firefox

P: 1
This is my first venture into simple browser detection.
I have a little image script that needs different centering code between Firefox and IE.

So this is what I have (it works except as explained below):

Expand|Select|Wrap|Line Numbers
  1. <![if !IE]>
  2. <div id="Carousel" style="position: relative; width: 400px; margin-left: auto; margin-right: auto;">
  3. ...
  4. </div>
  5. <![endif]>
  7. <![if IE]>
  8. <div id="Carousel" style="position: relative; text-align: center;">
  9. ...
  10. </div>
  11. <![endif]>
IE7 works fine with this workaround.
Firefox displays correctly but it allocates blank space the same size below the <div> (I assume for the IE <div>)
Looks like Firefox still reads inside the IE browser direction to layout page.

Am I on the right track?
I know this isn't the most elegant solution, any suggestions?

Jan 18 '07 #1
Share this Question
Share on Google+
2 Replies

Expert 100+
P: 1,892
Are you only trying to center an element? If so, there is a much simpler way to center an element in all browsers.
Jan 18 '07 #2

Expert 5K+
P: 7,435
You are using two methods that do two different things. In the first, you are centering the div. In the second, you are centering the text inside the element. In any case, Firefox performs the same as IE, so the problem you are having, I assume, is elsewhere.

Are you using a proper doctype?
Jan 18 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.