473,246 Members | 1,594 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,246 software developers and data experts.

XHTML - centering a table?

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
Feb 14 '08 #1
7 6559
On Feb 14, 1:31*pm, SpaceMarine <spacemar...@mailinator.comwrote:
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
ni**************@hotmail.com
contact form:
http://theodorakis.net/contact.html
Feb 14 '08 #2
Nick Theodorakis wrote:
On Feb 14, 1:31 pm, SpaceMarine <spacemar...@mailinator.comwrote:
>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.
Feb 14 '08 #3
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.

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.
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?
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/

Feb 14 '08 #4
On Feb 14, 2:20*pm, C A Upsdell <cupsd...@upsdell.invalidwrote:
Nick Theodorakis wrote:
On Feb 14, 1:31 pm, SpaceMarine <spacemar...@mailinator.comwrote:
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
ni**************@hotmail.com
contact form:
http://theodorakis.net/contact.html
Feb 14 '08 #5
On Feb 14, 2:09 pm, "Jukka K. Korpela" <jkorp...@cs.tut.fiwrote:
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."

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

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
Feb 14 '08 #6
On Feb 14, 3:37 pm, Nick Theodorakis <nick.theodora...@gmail.com>
wrote:
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
Feb 15 '08 #7
On Feb 14, 2:09 pm, "Jukka K. Korpela" <jkorp...@cs.tut.fiwrote:
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
Feb 15 '08 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: mike | last post by:
regards: I use Jtidy (api) to translate a HTML file into a "XHTML file". But The "XHTML file" cannot be identified by nokia 6600. Do I miss something important? Or this is Jtidy's weakness or...
19
by: George Ziniewicz | last post by:
.. I try to use CSS when possible, though I am still learning and don't maximize its use. In particular, I still use a table to provide for a centered image in a few slideshows (though table...
1
by: Kenneth | last post by:
Okay, I've been scouring Google for hours looking for a solution to this problem, but as of yet I can't find one. XHTML Transitional seems to specify that I can no longer set a table's height to...
3
by: yawnmoth | last post by:
I'm trying to center list elements in a webpage I'm working on, and setting margin-left to auto for ol (or ul) seems to prevent the number (or bullet) from displaying in IE6 (strict mode) and...
2
by: kevinC | last post by:
Hello, I know most of you are probably going seeing positioning:absolute; and centering in the title and saying, oh no! not again! Do a google search! Actually, I've found many helpful...
12
by: hawat.thufir | last post by:
I'm trying do some "screen scraping", and am using <http://www.oreilly.com/catalog/xmlhks/> for inspiration. First I'd like to convert XHTML to XML, or extract XML from XHTML, I'm not sure how...
5
by: Markus Ernst | last post by:
Hello This is a test example: http://www.markusernst.ch/anthracite/ http://www.markusernst.ch/anthracite/living_divani.html After googling and experimenting for several hours, I ended up...
2
by: rudicheow | last post by:
SHORT VERSION ============= I have a bunch of identical fixed-size single-celled tables that rest against each other horizontally thanks to "float:left". These tables are dynamically generated...
9
by: Neal | last post by:
http://www.brassattackofspringfield.com/gigs.html CSS at http://www.brassattackofspringfield.com/default.css Opera and IE render caption as desired. Firefox does not. Why? And is there a fix?
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.