We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 1828
    • 137 Posts
    I have a smoothgallery within a content div that has the style rule "text-align: center;". All the content in this div centers correctly in IE7 but not in FF2 where the smoothgallery box is left-aligned. I tried setting "text-align: center;" for the relevant elements in default.css with no luck. Can anyone shed some light on this?

    Thanks,
    Anton
      • 27708 MODX Staff
      • 2,502 Posts
      Using "text-align: center;" to center divs is not the best way to position them. The best way to center a div is to position it using the following:
      margin:0px auto;

      This works in all major browsers including IE7 and IE6. Make sure that you assign a width and remove the "text-align:center;" attribute/value.

      An URL would be helpful to be sure.

      Hope this helps.
        Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. Blog ✦ Twitter ✦ LinkedIn ✦ GitHub
        • 1828
        • 137 Posts
        Thanks, that did the trick. After reading your post, I realised that I’ve been down this road before, but I needed the reminder. Much appreciated. smiley
          • 27708 MODX Staff
          • 2,502 Posts
          We all need a reminder of stuff like this once and a while. Glad it helped.

          BTW you can actually drop the px in the code to read:

          margin:0 auto;


          It is less characters if you are into the lighter code thing.

          Cheers,

          Jay
            Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. Blog ✦ Twitter ✦ LinkedIn ✦ GitHub