SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    orange pips! orange pips!
    Join Date
    Oct 2001
    Location
    Its all about location
    Posts
    652
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Firefox and text-align

    Hi All,

    I'm trying to align a table to the right inside of a <div>, as such:

    HTML Code:
    <style>
    #mydiv {
    width: 100%;
    text-align: right;
    }
    </style>
    <body>
    <div id='mydiv'>
    <table><tr><td>1</td><td>2</td></tr></table>
    </div>
    </body>
    However, for Firefox this does not align the info inside of it to the right. Now, if I remove using the table and simply have text, it does work. Confusion has set in.

    Thanks in advance for any help you can provide.

  2. #2
    In memoriam gold trophysilver trophybronze trophy Dan Schulz's Avatar
    Join Date
    May 2006
    Location
    Aurora, Illinois
    Posts
    15,478
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    text-align is for alinging TEXT, not containers. If you want to align the container, use float instead. Or in your case, float: right;

  3. #3
    orange pips! orange pips!
    Join Date
    Oct 2001
    Location
    Its all about location
    Posts
    652
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, I've done the float: right;, putting a <div style='clear: right;'></div> right after it.

    If I don't specify a width, the container aligns to the right, but the container is only around the table data. I would like it to span 100% of the page. If I put a width: 100%;, the table data re-aligns itself to the left.

    ?

  4. #4
    In memoriam gold trophysilver trophybronze trophy Dan Schulz's Avatar
    Join Date
    May 2006
    Location
    Aurora, Illinois
    Posts
    15,478
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Any chance you could provide a link to the actual page in question? I think I know what you want to do, but I want to make sure first, so that way I don't screw up the rest of your layout.

  5. #5
    bronze trophy
    Join Date
    Dec 2004
    Location
    Sweden
    Posts
    2,670
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Float the table, not the div.
    Simon Pieters


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
  •