SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2003
    Location
    tazmania
    Posts
    38
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    centering javascript in firefox

    hey guys

    normally for firefox centering html this would work but it doesn't seem to with the script?

    <div style="text-align:center;">

    <div style="margin:auto 0px;"><script src="script.js"></script></div>
    </div>

    is there any other trick? the javascript is just a simple fixed width (779px) image scroller, it centres in IE fine.

    thanks.

  2. #2
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You've gotten the vertical and horizontal margins the wrong way round. Try
    HTML Code:
    <div style="width:779px; margin:0 auto">...</div>
    Note that you also need to set the width for the automatic horizontal margins to make any sense.
    Birnam wood is come to Dunsinane

  3. #3
    SitePoint Enthusiast
    Join Date
    Nov 2003
    Location
    tazmania
    Posts
    38
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    arrgg, i did have them the right away around in my code just posted it wrong here, but adding the width to the div did the trick, thankyou


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •