473,394 Members | 1,750 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,394 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 6564
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.