473,769 Members | 2,099 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

<colgroup><co l class="behold"> </colgroup>

The only browser I have encountered that supports
<colgroup><co l 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"o n every row item.

--

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
Aug 2 '08
36 5108
On Sat, 2 Aug 2008 21:23:45 +0300, "Jukka K. Korpela"
<jk******@cs.tu t.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
Roedy Green wrote:
On Sat, 2 Aug 2008 21:23:45 +0300, "Jukka K. Korpela"
<jk******@cs.tu t.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
Roedy Green wrote:
On Sat, 2 Aug 2008 21:23:45 +0300, "Jukka K. Korpela"
<jk******@cs.tu t.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
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><co l 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 misinterpretati ons.

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

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

<thead>
<colgroup><co l class="behold"> <col align="right"></colgroup applies
to header
</thead>
<tbody>
<colgroup><co l 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
In article <pb************ *************** *****@4ax.com>,
Roedy Green <se*********@mi ndprod.com.inva lidwrote:
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.co m/alt/tableNoInlineCS S.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
In article <g7**********@a ioe.org>,
ms******@walkab out.empros.com (Michael Stemper) wrote:
In article <48************ **********@news spool3.arcor-online.net>, Martin
Honnen <ma*******@yaho o.dewrites:
Roedy Green wrote:
The only browser I have encountered that supports
<colgroup><co l 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
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
On Wed, 06 Aug 2008 15:47:25 +1000, dorayme
<do************ @optusnet.com.a uwrote, quoted or indirectly quoted
someone who said :
>
This is meant to colour the first and third cols in a table:

<http://dorayme.890m.co m/alt/tableNoInlineCS S.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
On Wed, 06 Aug 2008 14:16:12 GMT, Joshua Cranmer
<Pi*******@veri zon.invalidwrot e, 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="strawber ry" 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
Roedy Green wrote:
On Wed, 06 Aug 2008 14:16:12 GMT, Joshua Cranmer
<Pi*******@veri zon.invalidwrot e, 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="strawber ry" 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

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

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.