SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: center box

Hybrid View

  1. #1
    SitePoint Enthusiast simon's's Avatar
    Join Date
    Feb 2005
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    center box

    Hello,
    I'm looking for information to center a box. This is my code:

    BODY {
    background: #8B0000;
    text-align: center;
    }

    .disclamerbox {
    border: 3px solid #FFD700;
    width: 500px;
    text-align: center;
    padding: 10px;
    float: none;
    }

    FireFox doesn't center this box. Have got any suggestions?

    Thank you.

  2. #2
    doing my best to help c2uk's Avatar
    Join Date
    May 2005
    Location
    Cardiff
    Posts
    1,832
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    text-align doesn't work for divs use margin: 0 auto; instead in the div you want to center.
    Dan G
    Marketing Strategist & Consultant

  3. #3
    SitePoint Enthusiast simonpointer's Avatar
    Join Date
    Jun 2006
    Location
    Guildford UK
    Posts
    85
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Assuming the centre box is inside (a child div of body), and that is all you have this works:

    BODY {
    background: #8B0000;
    text-align: center;
    }

    .disclamerbox {
    border: 3px solid #FFD700;
    width: 500px;
    margin: 0 auto;
    padding: 10px;
    text-align: left;
    }

    Add the text-align: left to .disclamerbox if you want the text (or anything else in side it) to re-align itself back to the left.


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
  •