SitePoint Sponsor |
|
User Tag List
Results 1 to 6 of 6
Thread: bah, center tag
-
Mar 24, 2004, 18:39 #1
- Join Date
- Nov 2003
- Location
- Washington, DC
- Posts
- 126
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
bah, center tag
Ok, I want to center a table and be xhtml strict...
I've tried using CSS:
PHP Code:div
{
text-align: center;
}
my code is along the lines of:
Code:<div> [table stuff] </div>
-
Mar 24, 2004, 18:41 #2Code:
div { text-align: center; /*for IE*/ } div table { /*for other browsers*/ text-align: left; margin: auto; }
-
Mar 24, 2004, 18:45 #3
- Join Date
- Nov 2003
- Location
- Washington, DC
- Posts
- 126
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by vgarcia
-
Mar 24, 2004, 18:57 #4
A margin value of "auto" tells the browser to take as much margin as possible. If "auto" is set on both the left and right margins, they will take up equal amounts of margin, effectively "centering" your element. As long as that element has a defined width, it will appear centered. The "text-align: left;" bit "resets" your text so it's not center-aligned. If you want centered text in your table on the other hand, feel free to remove that line.
Hope this helps!
-
Mar 24, 2004, 19:00 #5
- Join Date
- Nov 2003
- Location
- Washington, DC
- Posts
- 126
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
actually, i understood that before, but how does "div table" differ from simply "div"
-
Mar 24, 2004, 19:01 #6
"div table" selects any tables that are inside of a <div>. Nothing more to it really.
Bookmarks