W3C home > Mailing lists > Public > www-talk@w3.org > May to June 2001

Re: CSS to center a table?

From: Sean B. Palmer <sean@mysterylights.com>
Date: Sat, 19 May 2001 18:09:34 +0100
Message-ID: <017901c0e086$918ab500$eae793c3@z5n9x1>
To: <mjumbe@electricstoat.com>, <fish@infidels.org>, <Harshal_bhave@infy.com>
Cc: <www-talk@w3.org>
> > [censored] use "align=center" in your <TABLE> tags and
> > scrap the CSS approach.
>
> first, align="center" is deprecated.  it is better to say nothing
> and be thought a fool than to open your mouth and remove
> all doubt.

   Homer: Takes one to know one.
   Homer's Brain: Swish!

But do you know why align="center" is deprecated? Because it applies
style to an element based upon instance, rather than by semantics. The
point that is being made by its deprecation is that HTML is *not* a
visual output rendering mechanism - it's a language for semantically
delimiting content, or providing structure (disjoint from
presentation).

Using any of the following is basically the same [1]:-

   <table align="center">
   [...]

   <table style="align:center;">
   <!-- Had such a thing existed - it doesn't -->
   [...]

   <table class="center">
   [...]

except to say that 'class="center"' doesn't have any particular
attached presentation, other than that provided by the author.
However, the indication then is in the semantics of the particular
label used - in this case "center". Center implies some sort of
spatial tag for the element, and it is this concept which is
deprecated. You should be looking at *why* you are centering the
table, and work to that.

I suggest you refer to Al Gilman's carefully crafted reply on the
subject for more details, e.g.:-

[[[
You can make centering the global default behavior for TABLE elements,
independent of class, or have this style apply to (all,
class-independent) TABLE elements appearing in defined contexts, etc.
and later create special cases with a combination of context-pattern
guards and class filters. [...] The 'class' designations should be one
level more functional or logical than
the effects they trigger in a given medium.
]]] - http://lists.w3.org/Archives/Public/www-talk/2001MayJun/0085

Seems pretty clear to me. Make classes device independent.

[1] On a theoretical basis - implementations thereof are most likely
all screwed up and vary from UA to UA.

Homer: The Internet? Is that thing still around?

--
Kindest Regards,
Sean B. Palmer
@prefix : <http://webns.net/roughterms/> .
:Sean :hasHomepage <http://purl.org/net/sbp/> .
Received on Saturday, 19 May 2001 13:11:37 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 27 October 2010 18:14:26 GMT