By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,610 Members | 1,957 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,610 IT Pros & Developers. It's quick & easy.

<colgroup><col class="behold"></colgroup>

P: n/a
The only browser I have encountered that supports
<colgroup><col class="behold"></colgroup>
to apply a CSS style to a whole column, is Microsoft Internet
Explorer. I have been told it SHOULD NOT do so, since this is not
part of the specification.

How then to you apply styles to entire columns? Surely you don't have
to write

<td class="behold"on every row item.

--

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
Aug 2 '08 #1
Share this Question
Share on Google+
36 Replies


P: n/a
Roedy Green wrote:
The only browser I have encountered that supports
<colgroup><col class="behold"></colgroup>
to apply a CSS style to a whole column, is Microsoft Internet
Explorer. I have been told it SHOULD NOT do so, since this is not
part of the specification.
See http://www.w3.org/TR/CSS21/tables.html#columns, you can apply the
properties border, background, width, and visibility to columns and
column groups. So
col.behold {
background-color: lightblue;
}
should do.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Aug 2 '08 #2

P: n/a
Scripsit Roedy Green:
The only browser I have encountered that supports
<colgroup><col class="behold"></colgroup>
to apply a CSS style to a whole column, is Microsoft Internet
Explorer. I have been told it SHOULD NOT do so, since this is not
part of the specification.
Right, though this is a tricky and confusing issue.
How then to you apply styles to entire columns? Surely you don't have
to write

<td class="behold"on every row item.
Surely you have, if you wish to cover "all" browsers. But you can cover
virtually all significant CSS-enabled browsers by combining two
strategies:
a) use the <colapproach to cover IE
b) use contextual selectors to cover standards-conforming browsers; e.g.
td:first-child + td + td { ... }
is a way of assigning a style to the 3rd column, for rows that contain
td cells only.

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

Aug 2 '08 #3

P: n/a
On Sat, 02 Aug 2008 17:48:53 +0200, Martin Honnen <ma*******@yahoo.de>
wrote, quoted or indirectly quoted someone who said :
>
See http://www.w3.org/TR/CSS21/tables.html#columns, you can apply the
properties border, background, width, and visibility to columns and
column groups. So
col.behold {
background-color: lightblue;
}
should do.
My question is more about the markup to efficiently apply a style to
an entire column, hopefully in a single line, since the plausible
<colgroup><col style="behold"does not seem to work.
I wonder you would point me to a style sheet/html page that implements
some of these features that w3 URL talks about . My brain seems to
work much better generalising from some examples than reading the
lawyerly language spaces. Once I get the general idea from seeing some
examples, the specs make much more sense for gleaning the fine points.

--

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
Aug 2 '08 #4

P: n/a
Roedy Green wrote:
The only browser I have encountered that supports
<colgroup><col class="behold"></colgroup>
to apply a CSS style to a whole column, is Microsoft Internet
Explorer. I have been told it SHOULD NOT do so, since this is not
part of the specification.
As someone who is capable of understanding specs, and has discussed some
of these issues, there are actually a few elements that apply: border,
background, width, and visibility. There is actually a wonderful post by
Hixie that explains why this arrangement makes sense.
How then to you apply styles to entire columns? Surely you don't have
to write
You have several choices. The first thing to keep in mind that most of
the below will fail if you use colspan=""; David Baron (a key Mozilla
layout developer) has proposed the :nth-column() attribute which would
do the right thing in a better way, but nothing has come of it yet.

Choice #1 (supported by Opera, Safari, and alpha builds of Firefox 3.1):
td:nth-child(3) { /* etc */ }

Choice #2 (supported by IE 7, Opera, Safari, and Firefox):
td:first-child + td + td { /* etc */ }

Choice #3 (supported by all browsers) (works with colspan):
<td class="behold"on every row item.
Addendum:
IE 8 does not appear to claim to support :nth-child, but don't hold me
to that. Firefox 3.1 (IIRC) should be released in Q1 or Q2 2009. Support
for :nth-child was added there (IIRC) just after the release of 3.0, so
any Firefox 3.1 nightly should have support for :nth-child.

--
Beware of bugs in the above code; I have only proved it correct, not
tried it. -- Donald E. Knuth
Aug 2 '08 #5

P: n/a
In article <48**********************@newsspool3.arcor-online.net>, Martin Honnen <ma*******@yahoo.dewrites:
>Roedy Green wrote:
>The only browser I have encountered that supports
<colgroup><col class="behold"></colgroup>
to apply a CSS style to a whole column, is Microsoft Internet
Explorer. I have been told it SHOULD NOT do so, since this is not
part of the specification.

See http://www.w3.org/TR/CSS21/tables.html#columns, you can apply the
properties border, background, width, and visibility to columns and
column groups.
Well, that's pretty useless. The change that I most often want to make
to a column is to right-justify it, because numbers should be right-
justified for readability.

(I'm not blaming the messenger here.)

--
Michael F. Stemper
#include <Standard_Disclaimer>
I feel more like I do now than I did when I came in.
Aug 5 '08 #6

P: n/a
In article <GC*******************@reader1.news.saunalahti.fi> , "Jukka K. Korpela" <jk******@cs.tut.fiwrites:
>Scripsit Roedy Green:
>How then to you apply styles to entire columns? Surely you don't have
to write

<td class="behold"on every row item.

Surely you have, if you wish to cover "all" browsers. But you can cover
virtually all significant CSS-enabled browsers by combining two
strategies:
a) use the <colapproach to cover IE
b) use contextual selectors to cover standards-conforming browsers; e.g.
td:first-child + td + td { ... }
is a way of assigning a style to the 3rd column, for rows that contain
td cells only.
Well, that works nicely. Thanks.

However, I don't quite understand the need for the ":first-child"
pseudo-element. It seems to me, with my limited understanding, that
this would make the remainder ("+ td + td") apply only to something
*within* a TD. In fact, deleting ":first-child" from the style on a
test page didn't have any effect that was visible to me.

Could you explain the purpose of the ":first-child"?

--
Michael F. Stemper
#include <Standard_Disclaimer>
91.2% of all statistics are made up by the person quoting them.
Aug 5 '08 #7

P: n/a
In article <g7**********@aioe.org>, ms******@walkabout.empros.com (Michael Stemper) writes:
>In article <GC*******************@reader1.news.saunalahti.fi> , "Jukka K. Korpela" <jk******@cs.tut.fiwrites:
>>b) use contextual selectors to cover standards-conforming browsers; e.g.
td:first-child + td + td { ... }
is a way of assigning a style to the 3rd column, for rows that contain
td cells only.
>However, I don't quite understand the need for the ":first-child"
pseudo-element. It seems to me, with my limited understanding, that
this would make the remainder ("+ td + td") apply only to something
*within* a TD.
Never mind, I just had an epiphay. It means a TD that is a first child,
not the first child of a TD.

--
Michael F. Stemper
#include <Standard_Disclaimer>
91.2% of all statistics are made up by the person quoting them.
Aug 5 '08 #8

P: n/a
Jukka K. Korpela wrote:
Scripsit Roedy Green:
>The only browser I have encountered that supports
<colgroup><col class="behold"></colgroup>
to apply a CSS style to a whole column, is Microsoft Internet
Explorer. I have been told it SHOULD NOT do so, since this is not
part of the specification.

Right, though this is a tricky and confusing issue.
>How then to you apply styles to entire columns? Surely you don't have
to write

<td class="behold"on every row item.

Surely you have, if you wish to cover "all" browsers. But you can cover
virtually all significant CSS-enabled browsers by combining two strategies:
a) use the <colapproach to cover IE
b) use contextual selectors to cover standards-conforming browsers; e.g.
td:first-child + td + td { ... }
is a way of assigning a style to the 3rd column, for rows that contain
td cells only.
But it will unfortunately be broken by colspanning or rowspanning.

Aug 5 '08 #9

P: n/a
Scripsit Michael Stemper:
>a) use the <colapproach to cover IE
b) use contextual selectors to cover standards-conforming browsers;
e.g. td:first-child + td + td { ... }
is a way of assigning a style to the 3rd column, for rows that
contain td cells only.

Well, that works nicely. Thanks.

However, I don't quite understand the need for the ":first-child"
pseudo-element. It seems to me, with my limited understanding, that
this would make the remainder ("+ td + td") apply only to something
*within* a TD. In fact, deleting ":first-child" from the style on a
test page didn't have any effect that was visible to me.
I'm not quite sure that was all cleared up. Your comment later said that
you noticed that td:first-child means a td that _is_ a first child (of
some element). This is indeed confusing, and I still fall into this trap
when I'm tired.

At risk of saying something that is now obvious, I'd like to add that
td:first-child thus refers to cells in the first column (assuming all
cells are td and not th, for simplicity), and therefore td:first-child +
td refers to the second column etc. Without the :first-child part, the
selector works ok for a table with only three columns. But if there were
more columns,
td + td + td
would match cells in the third _and all subsequent_ columns.

For completeness, I also add that selectors like td + td don't work on
IE in "quirks mode", but they work on IE 7 in "standards mode". Just in
case someone tested it on IE 7: this would explain the odd phenomenon
that those selectors work there only if a DOCTYPE of a specific kind
appears at the start of the document.

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

Aug 5 '08 #10

P: n/a
On Sat, 2 Aug 2008 21:23:45 +0300, "Jukka K. Korpela"
<jk******@cs.tut.fiwrote, quoted or indirectly quoted someone who
said :
>b) use contextual selectors to cover standards-conforming browsers; e.g.
td:first-child + td + td { ... }
to make sense of this it would really help to see a complete example.
Is there a web page anywhere that implements this I can look at?

How should this work?

<tbody style="td:first-child
{color:blue};td:first-child+td{color:red}">

Is there a canonical place you should hang this first-child stuff?,
<table <colgroup <tbody?

My original desire was to apply the class .behold to all elements in a
given column.

To do that I need some sort of sytax like:

<tbody style="td:first-child
{class:behold};td:first-child+td{class:numeric;text-alignment:right}">
--

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
Aug 5 '08 #11

P: n/a
Roedy Green wrote:
On Sat, 2 Aug 2008 21:23:45 +0300, "Jukka K. Korpela"
<jk******@cs.tut.fiwrote, quoted or indirectly quoted someone who
said :
>b) use contextual selectors to cover standards-conforming browsers; e.g.
td:first-child + td + td { ... }

to make sense of this it would really help to see a complete example.
Is there a web page anywhere that implements this I can look at?

How should this work?

<tbody style="td:first-child
{color:blue};td:first-child+td{color:red}">
This will do "set the property td to first-child, then Oh! Parse error!"

You'll want to set up a style:
<style>
tbody#style td {
color: blue;
}
tbody#style td:first-child + td {
color: red;
}
</style>

<tbody id="style">

etc.

The style="" property can be considered a selector block for the
enclosing attribute with infinite specificity (it takes precedence over
all other rules, except !important rules, for which you can take
precedence with !important rules yourself).

--
Beware of bugs in the above code; I have only proved it correct, not
tried it. -- Donald E. Knuth
Aug 5 '08 #12

P: n/a
Roedy Green wrote:
On Sat, 2 Aug 2008 21:23:45 +0300, "Jukka K. Korpela"
<jk******@cs.tut.fiwrote, quoted or indirectly quoted someone who
said :
>b) use contextual selectors to cover standards-conforming browsers; e.g.
td:first-child + td + td { ... }

to make sense of this it would really help to see a complete example.
Is there a web page anywhere that implements this I can look at?

How should this work?

<tbody style="td:first-child
{color:blue};td:first-child+td{color:red}">
Ah, no, the style attribute doesn't work like that. It doesn't include
any selectors, just the properties to be applied to tag itself and their
values. Selectors are used to assign properties to elements in style
elements and in external stylesheets.

Haven't you looked at the CSS spec?

http://www.w3.org/TR/CSS21/

The section on selectors and their syntax:

http://www.w3.org/TR/CSS21/selector.html
Aug 6 '08 #13

P: n/a
On Tue, 05 Aug 2008 22:07:06 -0400, Harlan Messinger
<hm*******************@comcast.netwrote, quoted or indirectly quoted
someone who said :
>
Ah, no, the style attribute doesn't work like that. It doesn't include
any selectors, just the properties to be applied to tag itself and their
values. Selectors are used to assign properties to elements in style
elements and in external stylesheets.
Did the people who designed CSS every try USING this ruddy thing to
layout some tables?

Inline styles are a kludge. Ideally there should be none. You have all
your style stuff in the style sheet, not the HTML document.

It sounds like you are telling me you can't apply classes to columns
no matter what I do. I have to specify the style information in the
document itself. Yucch! That is antithecal to the whole CSS principle.

Arrgh!

Yes I have read the spec. But I could find nothing to solve my
problem. I originally presumed that browsers except IE were
non-compliant in understanding the obvious intended meaning of
<colgroup><col class="behold">

It is not designed for "humans". It is written in a lawyerly way
designed to be accessible to as few people as possible. It is
designed as a sort of academic one-up-manship game. This is true of
nearly all specification documents.

A spec should have a auxiliary document that defines the same
information with a set of examples that illustrate the points of the
spec.

The practice would lead to far fewer misinterpretations.

If I had the power to fix this, here is the pedestrian but practical
syntax I would recommend

<table>
<colgroup><col class="behold"><col align="right"></colgroup applies
to header and body

<thead>
<colgroup><col class="behold"><col align="right"></colgroup applies
to header
</thead>
<tbody>
<colgroup><col class="behold"><col align="right"></colgroup applies
to table body
</tbody>

--

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
Aug 6 '08 #14

P: n/a
In article <pb********************************@4ax.com>,
Roedy Green <se*********@mindprod.com.invalidwrote:
Did the people who designed CSS every try USING this ruddy thing to
layout some tables?
You seem to be be having trouble understanding the suggestions made to
you. Here is an example of a table that does what you want in nearly all
modern browsers I tested, it even works in the old Mac IE5!

This is meant to colour the first and third cols in a table:

<http://dorayme.890m.com/alt/tableNoInlineCSS.html>

No inline styles, just simple HTML and the barest lines of CSS in he
head for your convenience (though you can hive that off to an exteranl
sheet)

--
dorayme
Aug 6 '08 #15

P: n/a
In article <g7**********@aioe.org>,
ms******@walkabout.empros.com (Michael Stemper) wrote:
In article <48**********************@newsspool3.arcor-online.net>, Martin
Honnen <ma*******@yahoo.dewrites:
Roedy Green wrote:
The only browser I have encountered that supports
<colgroup><col class="behold"></colgroup>
to apply a CSS style to a whole column, is Microsoft Internet
Explorer. I have been told it SHOULD NOT do so, since this is not
part of the specification.
See http://www.w3.org/TR/CSS21/tables.html#columns, you can apply the
properties border, background, width, and visibility to columns and
column groups.

Well, that's pretty useless. The change that I most often want to make
to a column is to right-justify it, because numbers should be right-
justified for readability.

(I'm not blaming the messenger here.)
That's where there has been long and endless debate on the Bugzilla
system around why Firefox hasn't implemented CSS for tables the
way it is actually described in the CSS documents. Supposedly, a
fix is FINALLY in the works, but I'm not holding my breath. Oddly,
it's one of the few areas where IE more-or-less does what the specs
say...
Aug 6 '08 #16

P: n/a
David C. Stone wrote:
That's where there has been long and endless debate on the Bugzilla
system around why Firefox hasn't implemented CSS for tables the
way it is actually described in the CSS documents. Supposedly, a
fix is FINALLY in the works, but I'm not holding my breath. Oddly,
it's one of the few areas where IE more-or-less does what the specs
say...
In a quest to stop the spread of misinformation:
1. The bug in question is to support styling of columns via the HTML
presentational attributes.
2. The parent's reference to limited CSS column styling is, in fact correct.
3. To my knowledge, FF does support that part correctly.
4. IE does not do what the spec does, as Hixie outlines on his blog, the
link to which is included in one of my other posts on this thread.

--
Beware of bugs in the above code; I have only proved it correct, not
tried it. -- Donald E. Knuth
Aug 6 '08 #17

P: n/a
On Wed, 06 Aug 2008 15:47:25 +1000, dorayme
<do************@optusnet.com.auwrote, quoted or indirectly quoted
someone who said :
>
This is meant to colour the first and third cols in a table:

<http://dorayme.890m.com/alt/tableNoInlineCSS.html>
Thanks for showing an actual example, which is always the clearest way
to explain.. The problem with that technique is I must have a
different class for every possible table layout. I have hundreds of
them. I figure it should somehow be possible to define column styles
and apply a class to an individual whole column and in the style sheet
define centrally just what that means.

In other words I would like to apply classes at the column level
rather than the table level.
--

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
Aug 13 '08 #18

P: n/a
On Wed, 06 Aug 2008 14:16:12 GMT, Joshua Cranmer
<Pi*******@verizon.invalidwrote, quoted or indirectly quoted someone
who said :
>table thead td:first-child { /* styles from behold */ }
... etc. ...
I am a bit frustrated that nobody seems to acknowledge that being able
to specify color:red on a column is not anywhere near as useful as
being able to say class="strawberry" for a column. Everyone seems to
think they are equivalent.

It is a bit like pretending beer is perfectly identical to champagne
simply because no champagne is currently available.

The whole point of CSS is to control your layouts, colours and fonts
in the style sheet, not with specific commands embedded in the
documents. It is almost a reversion to using <font commands embedded
in your HTML markup.

I think CSS column formatting is broken. I think it could be fixed
very simply by expanding the use of <colspan>.

It would work like this:

<table>
<colspan<col class="behold"</colspan-- applies to head and body
<thead>
<colspan<col class="behold"</colspan-- applies just to head
</thead.>
<tbody>
<colspan<col class="behold"</colspan-- applies just to body

<tr>...</tr>
<colspan<col class="behold"</colspan-- applies to rest body
<tr>...</tr>

</tbody>

--

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
Aug 13 '08 #19

P: n/a
Roedy Green wrote:
On Wed, 06 Aug 2008 14:16:12 GMT, Joshua Cranmer
<Pi*******@verizon.invalidwrote, quoted or indirectly quoted someone
who said :
>table thead td:first-child { /* styles from behold */ }
... etc. ...

I am a bit frustrated that nobody seems to acknowledge that being able
to specify color:red on a column is not anywhere near as useful as
being able to say class="strawberry" for a column. Everyone seems to
think they are equivalent.

It is a bit like pretending beer is perfectly identical to champagne
simply because no champagne is currently available.

The whole point of CSS is to control your layouts, colours and fonts
in the style sheet, not with specific commands embedded in the
documents. It is almost a reversion to using <font commands embedded
in your HTML markup.

I think CSS column formatting is broken. I think it could be fixed
very simply by expanding the use of <colspan>.

It would work like this:

<table>
<colspan<col class="behold"</colspan-- applies to head and body
<thead>
<colspan<col class="behold"</colspan-- applies just to head
</thead.>
<tbody>
<colspan<col class="behold"</colspan-- applies just to body

<tr>...</tr>
<colspan<col class="behold"</colspan-- applies to rest body
<tr>...</tr>

</tbody>
I think you will find the problem is that the COL element does not
really "contain" any of the elements that you are trying to style. Kind
of counter to how CSS works. BTW the element is COLGROUP not COLSPAN.
COLSPAN is an *attribute* of the TH or TD element.

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
Aug 14 '08 #20

P: n/a
Roedy Green schrieb:
I am a bit frustrated that nobody seems to acknowledge that being able
to specify color:red on a column is not anywhere near as useful as
being able to say class="strawberry" for a column.
Of course you can 'say class="strawberry" for a column'. But the CSS
specification allows only very few properties to be applied to column
and column-group elements. Whether you apply properties via a inline,
internal or external style is not relevant.
The whole point of CSS is to control
s/control/suggest/
your layouts, colours and fonts
in the style sheet, not with specific commands embedded in the
documents.
--
Johannes Koch
In te domine speravi; non confundar in aeternum.
(Te Deum, 4th cent.)
Aug 14 '08 #21

P: n/a
Jonathan N. Little wrote:
I think you will find the problem is that the COL element does not
really "contain" any of the elements that you are trying to style. Kind
of counter to how CSS works.
I've found that most of CSS is counter to how CSS works once you are
inside a table. It's almost as though the designers wanted to push DIVs
in place of tables, so glossed over table support.

The one that bit me was expecting styling applied to a TR tag to be
inherited by the enclosed TD tags. I was gung-ho for migration to CSS
before I fell foul of this. I'm less enthusiastic now.

--
Steve Swift
http://www.swiftys.org.uk/swifty.html
http://www.ringers.org.uk
Aug 14 '08 #22

P: n/a
In article <aPimk.305$_H1.189@trnddc05>,
Joshua Cranmer <Pi*******@verizon.invalidwrote:
David C. Stone wrote:
That's where there has been long and endless debate on the Bugzilla
system around why Firefox hasn't implemented CSS for tables the
way it is actually described in the CSS documents. Supposedly, a
fix is FINALLY in the works, but I'm not holding my breath. Oddly,
it's one of the few areas where IE more-or-less does what the specs
say...

In a quest to stop the spread of misinformation:
1. The bug in question is to support styling of columns via the HTML
presentational attributes.
2. The parent's reference to limited CSS column styling is, in fact correct.
3. To my knowledge, FF does support that part correctly.
4. IE does not do what the spec does, as Hixie outlines on his blog, the
link to which is included in one of my other posts on this thread.
There is an example of using html+css to format a column of numbers
in such a way that the values are all aligned at the decimal point.
I tried replicating this example, and neither versions 1.5 nor 2.x
of FireFox would produce the results as shown in the CSS specs. I
haven't tried it since, and I haven't downloaded version 3 yet, so
I don't know if this has been fixed yet...
Aug 14 '08 #23

P: n/a
On Wed, 13 Aug 2008 23:48:37 -0400, "Jonathan N. Little"
<lw*****@central.netwrote, quoted or indirectly quoted someone who
said :

>I think you will find the problem is that the COL element does not
really "contain" any of the elements that you are trying to style. Kind
of counter to how CSS works
But that is defect that needs to be correct, not excused.
--

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
Aug 14 '08 #24

P: n/a
Roedy Green wrote:
Roedy Green wrote:
On Wed, 13 Aug 2008 23:48:37 -0400, "Jonathan N. Little"
<lw*****@central.netwrote, quoted or indirectly quoted someone who
said :

>I think you will find the problem is that the COL element does not
really "contain" any of the elements that you are trying to style. Kind
of counter to how CSS works

But that is defect that needs to be correct, not excused.

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.comOn Wed, 13 Aug 2008 23:48:37 -0400,
"Jonathan N. Little"
<lw*****@central.netwrote, quoted or indirectly quoted someone who
said :

>I think you will find the problem is that the COL element does not
really "contain" any of the elements that you are trying to style. Kind
of counter to how CSS works

But that is defect that needs to be correct, not excused.
Not in my opinion, COL and COLGROUP is basically a "presentational"
element like FONT.

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
Aug 15 '08 #25

P: n/a
Roedy Green wrote:
I think CSS column formatting is broken. I think it could be fixed
very simply by expanding the use of <colspan>.
No, this is because stuff happens at the wrong time. I've pointed you to
Hixie's post on the issue several times, but since you seem to not have
read it, I'll summarize for you.

First off, some background. CSS is based on a document format, so if it
can't be represented by the DOM (or, loosely, XML), it can't really be
done by CSS. I make this remark to hit one key point: an element cannot
have two parents.

CSS is also designed to be language-agnostic. That means that I should
be able to style an arbitrary XML file, instead of only HTML. Another
way to look at the issue is that a layout engine is an SGML parser that
has a default stylesheet with rules to specify how HTML works, at least
in terms of layout. So a <tableelement only acts that way because it
has "table { display: table; }".

The last thing to point out is this: CSS has a concept of inheritance.
For every element, every property is defined. If I don't have a (say)
color property, it's value then becomes inherited from its parent.

So we now parse the document. We get to a <td>. It has no color. So we
look at its parent, <tr>. It has no color. And we then look at its
parent, etc. Possibly we want to style from the column in this case, but
the column is not a parent of the cell. How can we possibly find it then?

I hear you muttering under your breath "you know what column it is in."
But you don't. Remember my second point? We don't know that because
we're at the end of the selector process. We need to know what the
element will look like before we start laying it out--the /computed
style/ of the element. To know the column from which to apply the
styles, we need to lay out the table, but we need to know the computed
style before then.

This "works" in IE because IE doesn't implement CSS correctly. It
doesn't do computed styles, which destroys a POWERFUL feature for one of
admittedly less use.

The four attributes that do work work because they're really special
containers. You can see them as a sort of ruling structure to put the
cells in the right place, so only things that affect the ruling work
(border puts a border along the rules, background puts a background that
could be covered up, width specifies the width of the rules, and
visibility: collapse hides the rules).

You'll see that the core problem here immediately relates back to the
fact that a cell /should/ have two parents, but the format it's
expressed in forbids this from happening.

There is one last thing to rebut: the idea of having some sort of "get
this attribute from the column" keyword value. Logically, this would
first do one thing: slow the layout dramatically, since you have to
crawl up stuff to find the column in which the cell is going to be
placed *and* its parental hierarchy. For every cell that has that
property. And, given developers, I think a lot of people will make this
true for all cells whether or not they need it. Which means this will
happen for every cell on every table on pages.

It would also break computed styles, since the style is being computed
at layout time and not parse time.

Sure, tables and CSS don't mix well. Part of that is because tables
don't work well in the DOM hierarchy. If you read the HTML spec, you'll
find that the only things that inherit there is alignment (the style
portion is overridden by CSS 2.1).

And it's <colgroup>, not <colspan:-)
<tr>...</tr>
<colspan<col class="behold"</colspan-- applies to rest body
<tr>...</tr>
Let me explain why this is bad.

First off, that implies that a <colgroupis "reset" by seeing another
one. You've just broken backwards compatibility big time there.

Second, colgroup is a group of columns. Keeping that in mind, that means
that the reset creates a new group of columns. Which means that you now
have new columns. Things like changing the width, etc., can now be
respecified, thereby making, effectively, a new table.

Complain to the W3C CSS list. Complain to the WHATWG list. I think
you'll find reception of these ideas among the spec-writers will be very
poor. Not because they're evil, but because it turns out to be
real-world impractical.

--
Beware of bugs in the above code; I have only proved it correct, not
tried it. -- Donald E. Knuth
Aug 16 '08 #26

P: n/a
Joshua Cranmer wrote:
The last thing to point out is this: CSS has a concept of inheritance.
It is one of the most misunderstood concepts that I ever heard of. The great
majority of statements relating to inheritance in CSS are wrong, based on
misunderstanding; the rest will be misunderstood by most people.
For every element, every property is defined.
Yes. But not every property is inherited.
If I don't have a (say)
color property, it's value then becomes inherited from its parent.
If your style sheet does not assign a value for a property of an element,
then the property still gets a value, but by cascade rules. Primarily, a
value specified in some other style sheet being applied will be used, by
certain priority rules. For example, a user style sheet might have
* { color: white; background: black; }

Only when _no_ style sheet (even a browser's default style sheet, which
might in principle contain just anything) assigns a value to a property for
an element will inheritance be considered. Even then, inheritance will take
place only if the property is defined as inherited in CSS specifications (as
the color property is). If it is not, the so-called initial value (as
defined for the property in CSS specs) will be used.
Sure, tables and CSS don't mix well.
That's another difficult topic, and it's really caused by fundamental design
problems in HTML _and_ in CSS.

Yucca

Aug 16 '08 #27

P: n/a
"Jukka K. Korpela" <jk******@cs.tut.fiwrites:
Primarily, a value specified in some other style sheet being
applied will be used, by certain priority rules.
It's called "specificity," not "priority." Please refrain from giving
advice concerning something about which you have no clue.

<http://www.w3.org/TR/CSS21/cascade.html#specificity>

sherm--

--
My blog: http://shermspace.blogspot.com
Cocoa programming in Perl: http://camelbones.sourceforge.net
Aug 16 '08 #28

P: n/a
Jukka K. Korpela wrote:
Joshua Cranmer wrote:
>The last thing to point out is this: CSS has a concept of inheritance.

It is one of the most misunderstood concepts that I ever heard of. The
great majority of statements relating to inheritance in CSS are wrong,
based on misunderstanding; the rest will be misunderstood by most people.
The inherit keyword is what does this. I was omitting that for the sake
of simplicity. But many properties are inherited, and it is these
properties that are in question, since the goal is to provide for
columns what a <tr class=""will do for rows.

So, for inherited properties, there is a concept of inheritance. And we
don't care about non-inherited properties right now...
>For every element, every property is defined.

Yes. But not every property is inherited.
Again, omission for simplicity. Many of the important properties that
one would wish to style are, in fact, inherited.
If your style sheet does not assign a value for a property of an
element, then the property still gets a value, but by cascade rules.
I'm referring to after the cascade. This is probably the case most of
the time.
Even then, inheritance
will take place only if the property is defined as inherited in CSS
specifications (as the color property is). If it is not, the so-called
initial value (as defined for the property in CSS specs) will be used.
Again, I'm omitting for simplicity.

--
Beware of bugs in the above code; I have only proved it correct, not
tried it. -- Donald E. Knuth
Aug 16 '08 #29

P: n/a
On 2008-08-16, Jukka K. Korpela <jk******@cs.tut.fiwrote:
[...]
Only when _no_ style sheet (even a browser's default style sheet, which
might in principle contain just anything) assigns a value to a property for
an element will inheritance be considered.
Or when a stylesheet assigns the value "inherit" (but "inherit" can only
be used for some properties).

For the sake of completeness I point out that inheritance is also
considered in some cases when properties are applied to CSS boxes that
don't correspond to HTML elements.

Anonymous inline and block boxes inherit inheritable properties from
their block parents.

Anonymous table objects I'm not sure about. I can't see where in the
spec it says that they should inherit inheritable properties, but I just
tried a test and it seems they do in Firefox, Opera and Konqueror.

http://www.tidraso.co.uk/misc/anonTableInheritance.html
Aug 16 '08 #30

P: n/a
Sherm Pendley wrote:
"Jukka K. Korpela" <jk******@cs.tut.fiwrites:
>Primarily, a value specified in some other style sheet being
applied will be used, by certain priority rules.

It's called "specificity," not "priority."
Which "it"? "Priority" is a common English word and just fine in an informal
description.

"Specificity" is a technical term used in CSS specifications to refer to
_one_ feature of the priority rules, also known as "cascading rules", which
is a fairly misleading metaphor.

Did you think that specificity alone determines which value will be used?
Then you are quite wrong and should read a good book on CSS.
Please refrain from giving
advice concerning something about which you have no clue.
Do you think you are funny?

Aug 16 '08 #31

P: n/a
"Jukka K. Korpela" <jk******@cs.tut.fiwrites:
Do you think you are funny?
In general, or in the post to which you're responding? Are you using
the word "you" in the singular or the plural sense? What about the
word "funny" - do you intend to ask someone (me?) if they believe
their post to be humorous, or strange?

Your question, as written, doesn't make the slightest bit of sense.
Don't you realize that wasting everyone's time with such illiterate
gibberish is disrespectful and insulting? Is a well-written question
too much to ask for? Why are you attempting to write in English when
you obviously haven't the slightest clue how to do so properly?

sherm--

--
My blog: http://shermspace.blogspot.com
Cocoa programming in Perl: http://camelbones.sourceforge.net
Aug 16 '08 #32

P: n/a
Sherm Pendley wrote:
Don't you realize that wasting everyone's time with such illiterate
gibberish is disrespectful and insulting?
It seems that you have stopped writing about CSS, which might be an
improvement, since last time you tried to write about CSS (at least
nominally) you made a foolish personal attack _and_ presented quite wrong
information about CSS.

I will take the opportunity to thank you for informing us so clearly that
your posts can be ignored without losing anything but crap. I would have
sent this personally to avoid wasting other people's time, but your email
address looks forged, and that's a sufficient reason for not trying to mail
to it.

Aug 16 '08 #33

P: n/a
"Jukka K. Korpela" <jk******@cs.tut.fiwrites:
but your email address looks forged
On what basis did you come to that conclusion? You didn't even try
it. Once more, you arrogantly assume to know everything. And, once
more, such assumptions do nothing but make you look foolish.

You have nothing useful to say here, so why not just leave?

sherm--

--
My blog: http://shermspace.blogspot.com
Cocoa programming in Perl: http://camelbones.sourceforge.net
Aug 16 '08 #34

P: n/a
On Fri, 15 Aug 2008 20:00:15 -0400, Joshua Cranmer
<Pi*******@verizon.invalidwrote, quoted or indirectly quoted someone
who said :
>I make this remark to hit one key point: an element cannot
have two parents.
But that is not a sensible restriction. I am not doubting you that is
the way it is, but I am saying it is simply not good enough.

Pages are TWO dimensional. That does not fit the current single
inheritance paradigm.

It is not rocket science to extend the syntax to give you the ability
to apply styles and classes to entire columns, or even parts of
columns.

It is prissy academic attitudes that prevent the W3C people from
implementing this practical necessity because they are in love with
the beauty of the current formalism.
--

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
Aug 22 '08 #35

P: n/a
Roedy Green wrote:
Pages are TWO dimensional. That does not fit the current single
inheritance paradigm.
Suggest a syntax as to how to designate an element as having two
parents. Suggest APIs for the DOM that are both backwards-compatible and
capable of having multiple parents. And that's only the beginning.

Tables are the only place where this really happens, but there is no
real way to actually implement a table ideally. Even in the first
versions of HTML, it didn't work too well, because SGML has a similar
one-parent binding.

And as much as you would like to ignore backwards compatibility, the web
is one place where ignoring it will land you in very hot water, as the
Trident development team has no doubt discovered.
It is not rocket science to extend the syntax to give you the ability
to apply styles and classes to entire columns, or even parts of
columns.
Make a syntax and suggest it to the WHATWG HTML or W3C CSS mailing lists
(depending on how you do it). See what the reception is.
It is prissy academic attitudes that prevent the W3C people from
implementing this practical necessity because they are in love with
the beauty of the current formalism.
I don't think anyone's happy, let alone in love, with the table status
quo. But, as the saying goes, the mark of a good compromise is that
everyone's unhappy.

The primary detracting point is that what is being proposed would need
to remake the core of CSS or HTML/DOM. It's not "prissy academic
attitudes" but the reality of the difficulties of making a layout engine
that is both correct and fast, among other not-quite-so-important
characteristics.

--
Beware of bugs in the above code; I have only proved it correct, not
tried it. -- Donald E. Knuth
Aug 22 '08 #36

P: n/a
Roedy Green wrote:
On Fri, 15 Aug 2008 20:00:15 -0400, Joshua Cranmer
<Pi*******@verizon.invalidwrote, quoted or indirectly quoted someone
who said :
>I make this remark to hit one key point: an element cannot
have two parents.

But that is not a sensible restriction. I am not doubting you that is
the way it is, but I am saying it is simply not good enough.
The HTML document model is a tree, so by definition every node except
the root has exactly one parent. It's inherent in the language.
Therefore, it's as good as it's going to be.
Pages are TWO dimensional. That does not fit the current single
inheritance paradigm.
Design a new non-tree-based markup language and see about getting it
adopted.
It is not rocket science to extend the syntax to give you the ability
to apply styles and classes to entire columns, or even parts of
columns.

It is prissy academic attitudes that prevent the W3C people from
implementing this practical necessity because they are in love with
the beauty of the current formalism.
I've already seen others explain to you the *practical* problems
involved in what you're wishing for, so for you to ascribe what you
perceive as shortcomings to "prissy academic attitudes" shows that you
weren't paying attention.
Aug 22 '08 #37

This discussion thread is closed

Replies have been disabled for this discussion.