SitePoint Sponsor |
|
User Tag List
Results 1 to 3 of 3
Thread: center box
-
Jun 19, 2006, 13:20 #1
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.
-
Jun 19, 2006, 13:27 #2
- 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
-
Jun 19, 2006, 14:42 #3
- 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