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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kraves
    New Member
    • Jan 2007
    • 1

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

    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):

    Code:
    <![if !IE]>
    <div id="Carousel" style="position: relative; width: 400px; margin-left: auto; margin-right: auto;">
    ...
    </div>
    <![endif]>
    
    <![if IE]>
    <div id="Carousel" style="position: relative; text-align: center;">
    ...
    </div>
    <![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?

    Kyle.
  • AricC
    Recognized Expert Top Contributor
    • Oct 2006
    • 1885

    #2
    Are you only trying to center an element? If so, there is a much simpler way to center an element in all browsers.

    Comment

    • drhowarddrfine
      Recognized Expert Expert
      • Sep 2006
      • 7434

      #3
      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?

      Comment

      Working...