HighDots Forums  

XHTML - centering a table?

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss XHTML - centering a table? in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
SpaceMarine
 
Posts: n/a

Default XHTML - centering a table? - 02-14-2008 , 12:31 PM






hello,

i see that <table align="center"> is no longer valid markup in XHTML.
nor is <center><table></table></center>.

how then does one center a table?

found articles for centering text:

http://msconline.maconstate.edu/Tuto...xhtml03-03.htm

....but that doesnt help on a table because i dont want the text
*inside* the table centered, only the table itself.


surely this most be a common task?


thanks!
sm

Reply With Quote
  #2  
Old   
Nick Theodorakis
 
Posts: n/a

Default Re: XHTML - centering a table? - 02-14-2008 , 12:50 PM






On Feb 14, 1:31*pm, SpaceMarine <spacemar... (AT) mailinator (DOT) com> wrote:
Quote:
hello,

i see that <table align="center"> is no longer valid markup in XHTML.
nor is <center><table></table></center>.

how then does one center a table?

Set the left and right margins of the table to "auto" in your style
sheet.

Nick

--
Nick Theodorakis
nick_theodorakis (AT) hotmail (DOT) com
contact form:
http://theodorakis.net/contact.html


Reply With Quote
  #3  
Old   
C A Upsdell
 
Posts: n/a

Default Re: XHTML - centering a table? - 02-14-2008 , 01:20 PM



Nick Theodorakis wrote:
Quote:
On Feb 14, 1:31 pm, SpaceMarine <spacemar... (AT) mailinator (DOT) com> wrote:
hello,

i see that <table align="center"> is no longer valid markup in XHTML.
nor is <center><table></table></center>.

how then does one center a table?


Set the left and right margins of the table to "auto" in your style
sheet.
Which will not work with older versions of IE still being used, so you
may have to handle that.


Reply With Quote
  #4  
Old   
Jukka K. Korpela
 
Posts: n/a

Default Re: XHTML - centering a table? - 02-14-2008 , 02:09 PM



Scripsit SpaceMarine:

Quote:
i see that <table align="center"> is no longer valid markup in XHTML.
It is.

Quote:
nor is <center><table></table></center>.
It is.

You don't really know what XHTML is, do you? Don't worry, most other
authors who use XHTML don't know that either. But you might draw the
conclusions and upgrade to HTML 4.01, which is far better supported by
current browsers.

Quote:
how then does one center a table?
There are ways to do that in CSS (consider checking the FAQs), but why
bother, if you already know the HTML way?

Quote:
surely this most be a common task?
It's not. Why would you want to center a table?

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/



Reply With Quote
  #5  
Old   
Nick Theodorakis
 
Posts: n/a

Default Re: XHTML - centering a table? - 02-14-2008 , 03:37 PM



On Feb 14, 2:20*pm, C A Upsdell <cupsd... (AT) upsdell (DOT) invalid> wrote:
Quote:
Nick Theodorakis wrote:
On Feb 14, 1:31 pm, SpaceMarine <spacemar... (AT) mailinator (DOT) com> wrote:
hello,

i see that <table align="center"> is no longer valid markup in XHTML.
nor is <center><table></table></center>.

how then does one center a table?

Set the left and right margins of the table to "auto" in your style
sheet.

Which will not work with older versions of IE still being used, so you
may have to handle that.
It'll work with IE down to version 6 as long as standards mode is
invoked (and it needs to be invoked even to get it work with IE7). If
the OP wants to make it work with IE5 (and even Netscape 4) I still
have my old table centering page up:

<http://theodorakis.net/tablecentertest.html>

Although I felt a little hesitant to plug it in my other post.

Nick

--
Nick Theodorakis
nick_theodorakis (AT) hotmail (DOT) com
contact form:
http://theodorakis.net/contact.html


Reply With Quote
  #6  
Old   
SpaceMarine
 
Posts: n/a

Default Re: XHTML - centering a table? - 02-14-2008 , 05:53 PM



On Feb 14, 2:09 pm, "Jukka K. Korpela" <jkorp... (AT) cs (DOT) tut.fi> wrote:
Quote:
Scripsit SpaceMarine:

i see that <table align="center"> is no longer valid markup in XHTML.

It is.

nor is <center><table></table></center>.

It is.
not according to my XHTML 1.0 Transitional validation tool (Visual
Studio 2005) -- "...is considered outdated. A newer construct is
recommended."


Quote:
There are ways to do that in CSS (consider checking the FAQs),
im asking here.


Quote:
surely this most be a common task?

It's not. Why would you want to center a table?
who are you to question why i want to center a table?

are you always such a useless fart-bubble twit? or just online?


sm


Reply With Quote
  #7  
Old   
SpaceMarine
 
Posts: n/a

Default Re: XHTML - centering a table? - 02-14-2008 , 06:04 PM



On Feb 14, 3:37 pm, Nick Theodorakis <nick.theodora... (AT) gmail (DOT) com>
wrote:
Quote:
It'll work with IE down to version 6 as long as standards mode is
invoked (and it needs to be invoked even to get it work with IE7). If
the OP wants to make it work with IE5 (and even Netscape 4) I still
have my old table centering page up:

http://theodorakis.net/tablecentertest.html
very useful, thanks nick.

sm


Reply With Quote
  #8  
Old   
SpaceMarine
 
Posts: n/a

Default Re: XHTML - centering a table? - 02-14-2008 , 06:14 PM



On Feb 14, 2:09 pm, "Jukka K. Korpela" <jkorp... (AT) cs (DOT) tut.fi> wrote:

Quote:
There are ways to do that in CSS (consider checking the FAQs), but why
bother, if you already know the HTML way?
ps, Twit Master 3000 -- it is better to define layout in CSS over HTML
anyway, as it lets the style doc render the content dynamically based
on what the current medium is. for instance, my project uses one set
of CSS docs for web browsers, and another for handhelds. prefer not to
"hard code" the alignments in HTML even if they were standards-
compliant tags, which i dont think they are any longer (see above).

but, i found my solution, thanks to nick. im outtie. ta!


sm


Reply With Quote
  #9  
Old   
Jukka K. Korpela
 
Posts: n/a

Default Re: XHTML - centering a table? - 02-15-2008 , 09:38 AM



Scripsit SpaceMarine:

Quote:
not according to my XHTML 1.0 Transitional validation tool (Visual
Studio 2005) -- "...is considered outdated. A newer construct is
recommended."
You have been cheated. You get no sympathy points, though, since:

Quote:
are you always such a useless fart-bubble twit? or just online?
You are a disgusting coward who attacks named persons in public, hiding
under a fake name. This is far worse than your apparent ignorance in
HTML, CSS, and web design matters. Please keep the same fake identity as
long as you just throw shit around. Thank you in advance.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/



Reply With Quote
  #10  
Old   
Joshua Cranmer
 
Posts: n/a

Default Re: XHTML - centering a table? - 02-15-2008 , 04:01 PM



SpaceMarine wrote:
Quote:
On Feb 14, 2:09 pm, "Jukka K. Korpela" <jkorp... (AT) cs (DOT) tut.fi> wrote:
Scripsit SpaceMarine:

i see that <table align="center"> is no longer valid markup in XHTML.
It is.

nor is <center><table></table></center>.
It is.

not according to my XHTML 1.0 Transitional validation tool (Visual
Studio 2005) -- "...is considered outdated. A newer construct is
recommended."
From reading that message, it appears that it's merely bad text. Your
tool is telling you that the usage is deprecated, not invalid. See
http://www.w3.org/TR/XHTML10 if you want more information.

Quote:
There are ways to do that in CSS (consider checking the FAQs),

im asking here.
And the first rule of asking questions on Usenet is to indicate that you
have already looked for the answer. `center +CSS' on Google returns
relevant results as hits #2 and #3.

Quote:
surely this most be a common task?
It's not. Why would you want to center a table?

who are you to question why i want to center a table?
All too often people ask how to do XXX to solve YYY when method ZZZ
solves YYY much easier than trying to do XXX.

--
Beware of bugs in the above code; I have only proved it correct, not
tried it. -- Donald E. Knuth


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.