<colgroup><col class="behold"></colgroup>
|
|
Thread rating:  |
Roedy Green - 02 Aug 2008 16:32 GMT 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.
 Signature Roedy Green Canadian Mind Products The Java Glossary http://mindprod.com
Martin Honnen - 02 Aug 2008 16:48 GMT > 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.
 Signature Martin Honnen http://JavaScript.FAQTs.com/
Roedy Green - 02 Aug 2008 20:46 GMT >See http://www.w3.org/TR/CSS21/tables.html#columns, you can apply the >properties border, background, width, and visibility to columns and [quoted text clipped - 3 lines] > } >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.
 Signature Roedy Green Canadian Mind Products The Java Glossary http://mindprod.com
Michael Stemper - 05 Aug 2008 18:25 GMT >> The only browser I have encountered that supports >> <colgroup><col class="behold"></colgroup> [quoted text clipped - 5 lines] >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.)
 Signature Michael F. Stemper #include <Standard_Disclaimer> I feel more like I do now than I did when I came in.
David C. Stone - 06 Aug 2008 15:24 GMT > >> The only browser I have encountered that supports > >> <colgroup><col class="behold"></colgroup> [quoted text clipped - 11 lines] > > (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...
Joshua Cranmer - 06 Aug 2008 15:46 GMT > 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.
 Signature Beware of bugs in the above code; I have only proved it correct, not tried it. -- Donald E. Knuth
David C. Stone - 14 Aug 2008 15:59 GMT > > That's where there has been long and endless debate on the Bugzilla > > system around why Firefox hasn't implemented CSS for tables the [quoted text clipped - 10 lines] > 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...
Jukka K. Korpela - 02 Aug 2008 19:23 GMT 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 <col> approach 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.
 Signature Jukka K. Korpela ("Yucca") http://www.cs.tut.fi/~jkorpela/
Michael Stemper - 05 Aug 2008 18:48 GMT >Scripsit Roedy Green:
>> How then to you apply styles to entire columns? Surely you don't have >> to write [quoted text clipped - 9 lines] >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"?
 Signature Michael F. Stemper #include <Standard_Disclaimer> 91.2% of all statistics are made up by the person quoting them.
Michael Stemper - 05 Aug 2008 18:53 GMT >>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.
 Signature Michael F. Stemper #include <Standard_Disclaimer> 91.2% of all statistics are made up by the person quoting them.
Jukka K. Korpela - 05 Aug 2008 20:50 GMT Scripsit Michael Stemper:
>> a) use the <col> approach to cover IE >> b) use contextual selectors to cover standards-conforming browsers; [quoted text clipped - 9 lines] > *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.
 Signature Jukka K. Korpela ("Yucca") http://www.cs.tut.fi/~jkorpela/
Harlan Messinger - 05 Aug 2008 19:52 GMT > Scripsit Roedy Green: > [quoted text clipped - 18 lines] > 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.
Roedy Green - 06 Aug 2008 00:25 GMT On Sat, 2 Aug 2008 21:23:45 +0300, "Jukka K. Korpela" <jkorpela@cs.tut.fi> wrote, 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}">
 Signature
Roedy Green Canadian Mind Products The Java Glossary http://mindprod.com
Joshua Cranmer - 06 Aug 2008 00:31 GMT > On Sat, 2 Aug 2008 21:23:45 +0300, "Jukka K. Korpela" > <jkorpela@cs.tut.fi> wrote, quoted or indirectly quoted someone who [quoted text clipped - 10 lines] > <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).
 Signature Beware of bugs in the above code; I have only proved it correct, not tried it. -- Donald E. Knuth
Harlan Messinger - 06 Aug 2008 03:07 GMT > On Sat, 2 Aug 2008 21:23:45 +0300, "Jukka K. Korpela" > <jkorpela@cs.tut.fi> wrote, quoted or indirectly quoted someone who [quoted text clipped - 10 lines] > <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
Roedy Green - 06 Aug 2008 06:23 GMT On Tue, 05 Aug 2008 22:07:06 -0400, Harlan Messinger <hmessinger.removethis@comcast.net> wrote, 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>
 Signature Roedy Green Canadian Mind Products The Java Glossary http://mindprod.com
dorayme - 06 Aug 2008 06:47 GMT > 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)
 Signature dorayme
Roedy Green - 14 Aug 2008 00:35 GMT On Wed, 06 Aug 2008 15:47:25 +1000, dorayme <doraymeRidThis@optusnet.com.au> wrote, 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.
 Signature
Roedy Green Canadian Mind Products The Java Glossary http://mindprod.com
Harlan Messinger - 06 Aug 2008 12:59 GMT > On Tue, 05 Aug 2008 22:07:06 -0400, Harlan Messinger > <hmessinger.removethis@comcast.net> wrote, quoted or indirectly quoted [quoted text clipped - 14 lines] > 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. AFAIK you can apply classes. It's the set of properties that can be set for them--whether in style attributes or via selectors--that's limited. I asked about that here a few years ago myself when I couldn't seem to set something or other for columns, and someone took the trouble to explain to me why it was problematic to allow some of the properties to be set for columns. IIRC, it had to do with the order in which the parts of the table are laid out, and allowing certain properties to be assigned for columns created a deadlock.
> Arrgh! > [quoted text clipped - 7 lines] > designed as a sort of academic one-up-manship game. This is true of > nearly all specification documents. I figured you could handle it since you dealt so thoroughly with Java years ago and I assumed you had gotten much of the detail from Sun's often opaque documentation. :-)
Joshua Cranmer - 06 Aug 2008 15:16 GMT > Did the people who designed CSS every try USING this ruddy thing to > layout some tables? Do the people who use CSS ever try writing a CSS layout engine? The limitations of CSS w.r.t. tables are because they can't really be done right. CSS, in broad terms, selects the elements before laying them out.
Think about how the display: property works. In order to know how to layout, you need to know what the display will look like. You therefore need to know what CSS properties apply to an element before you can determine how to lay out the element.
Assuming no colspans, the column can be colored with this CSS:
table#id td:first-child + td + td { color: green; }
I've used that before to style columns, and bit the bullet when IE 6 didn't support that (which didn't matter, because the only people who were viewing said page would be viewing it either Opera or Firefox).
And when FF 3.1 becomes widely used, I could use this:
table#id td:nth-child(3) { color: green; }
> 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. No you don't. Just style the table as I showed you above this paragraph (preferably the first one, that works in most browsers). And don't use colspans.
Colspans are the breaking point of CSS tables. Tables themselves are broken in many ways, least of all because a cell should theoretically have two parents yet the DOM dictates that an element can only have one parent. Since a colspan itself cannot be specified by any means internally to CSS, it stands to reason that CSS cannot provide a way to resolve the issue of colspans.
> 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"> /me holds up the adjacent child, first-child, and and nth-child selectors
O.K., it's CSS 3 Selectors, but CSS 3 Selectors has more widespread support in browsers than parts of CSS 2.1.
> 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. B.S. The CSS spec is designed to be used for implementors. I am gambling that you have never written, thought of writing, nor even looked at a CSS layout engine's internals before. A lot of stuff that web authors would like to see in CSS cannot be specified because it is impractical for implementors. A parent selector is a good example here.
If you approach a specification document with the mindset that it is intended primarily to specifically define how it is to be implemented rather than used, you will find that they often become nice and easy to understand. Specification authors have to be more concerned with being /correct/ and interoperable in /all/ circumstances than being easy for people writing it to read.
Example: C++ has a long section on name resolution. It can be boiled down in most cases to "look at the innermost scope and work outwards." That's fine if I'm writing C++. If I'm writing a C++ compiler, though, that's a crappy description.
To paraphrase someone else on CSS: browsers need to be able to handle someone who sets their browser window to 15 pixels by 10 pixels, therefore the spec has to deal with that in some way. But most authors won't see anyone with a 15x10 window, all they see is a window measuring several hundred pixels by several hundred, with perhaps slight variations in the exact size.
> A spec should have a auxiliary document that defines the same > information with a set of examples that illustrate the points of the > spec. Test suites, anyone? The CSS spec does have examples on a few of the points for better illustrations.
> 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 table td:first-child { /* styles from behold */ } table td:first-child + td { text-align: right; }
> <thead> > <colgroup><col class="behold"><col align="right"></colgroup> applies > to header > </thead> table thead td:first-child { /* styles from behold */ } ... etc. ...
I don't see why you're complaining.
 Signature Beware of bugs in the above code; I have only proved it correct, not tried it. -- Donald E. Knuth
Roedy Green - 14 Aug 2008 00:47 GMT On Wed, 06 Aug 2008 14:16:12 GMT, Joshua Cranmer <Pidgeot18@verizon.invalid> wrote, 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>
 Signature Roedy Green Canadian Mind Products The Java Glossary http://mindprod.com
Jonathan N. Little - 14 Aug 2008 04:48 GMT > On Wed, 06 Aug 2008 14:16:12 GMT, Joshua Cranmer > <Pidgeot18@verizon.invalid> wrote, quoted or indirectly quoted someone [quoted text clipped - 34 lines] > > </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.
 Signature Take care, Jonathan ------------------- LITTLE WORKS STUDIO http://www.LittleWorksStudio.com
Steve Swift - 14 Aug 2008 08:47 GMT > 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.
 Signature Steve Swift http://www.swiftys.org.uk/swifty.html http://www.ringers.org.uk
Jonathan N. Little - 15 Aug 2008 23:03 GMT >> 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. [quoted text clipped - 7 lines] > 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. What? Sure it does, depends on what property...
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <meta http-equiv="content-language" content="en-us"> <title>Works</title> <style type="text/css"> tr { color: red; } </style>
</head> <body> <table> <tr><th>Foo</th><th>Bar</th></tr> <tr><td>I am red</td><td>I am red</td></tr> <table> </body> </html>
 Signature Take care, Jonathan ------------------- LITTLE WORKS STUDIO http://www.LittleWorksStudio.com
Roedy Green - 14 Aug 2008 23:27 GMT On Wed, 13 Aug 2008 23:48:37 -0400, "Jonathan N. Little" <lws4art@central.net> wrote, 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.
 Signature
Roedy Green Canadian Mind Products The Java Glossary http://mindprod.com
Jonathan N. Little - 15 Aug 2008 23:08 GMT > On Wed, 13 Aug 2008 23:48:37 -0400, "Jonathan N. Little" > <lws4art@central.net> wrote, quoted or indirectly quoted someone who [quoted text clipped - 5 lines] > > But that is defect that needs to be correct, not excused.
 Signature Take care, Jonathan ------------------- LITTLE WORKS STUDIO http://www.LittleWorksStudio.com> On Wed, 13 Aug 2008 23:48:37 -0400, "Jonathan N. Little"
> <lws4art@central.net> wrote, quoted or indirectly quoted someone who > said : [quoted text clipped - 4 lines] > > 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.
 Signature Take care, Jonathan ------------------- LITTLE WORKS STUDIO http://www.LittleWorksStudio.com
Johannes Koch - 14 Aug 2008 08:32 GMT 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.
 Signature Johannes Koch In te domine speravi; non confundar in aeternum. (Te Deum, 4th cent.)
Joshua Cranmer - 16 Aug 2008 01:00 GMT > 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 <table> element 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 <colgroup> is "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.
 Signature Beware of bugs in the above code; I have only proved it correct, not tried it. -- Donald E. Knuth
Jukka K. Korpela - 16 Aug 2008 06:42 GMT > 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
Sherm Pendley - 16 Aug 2008 14:48 GMT > 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--
 Signature My blog: http://shermspace.blogspot.com Cocoa programming in Perl: http://camelbones.sourceforge.net
Jukka K. Korpela - 16 Aug 2008 20:59 GMT >> 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?
Sherm Pendley - 16 Aug 2008 21:29 GMT > 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--
 Signature My blog: http://shermspace.blogspot.com Cocoa programming in Perl: http://camelbones.sourceforge.net
Jukka K. Korpela - 16 Aug 2008 21:39 GMT > 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.
Sherm Pendley - 16 Aug 2008 21:54 GMT > 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--
 Signature My blog: http://shermspace.blogspot.com Cocoa programming in Perl: http://camelbones.sourceforge.net
Joshua Cranmer - 16 Aug 2008 15:46 GMT >> 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.
 Signature Beware of bugs in the above code; I have only proved it correct, not tried it. -- Donald E. Knuth
Ben C - 16 Aug 2008 15:51 GMT [...]
> 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
Roedy Green - 22 Aug 2008 16:14 GMT On Fri, 15 Aug 2008 20:00:15 -0400, Joshua Cranmer <Pidgeot18@verizon.invalid> wrote, 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.
 Signature Roedy Green Canadian Mind Products The Java Glossary http://mindprod.com
Joshua Cranmer - 22 Aug 2008 16:39 GMT > 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.
 Signature Beware of bugs in the above code; I have only proved it correct, not tried it. -- Donald E. Knuth
Harlan Messinger - 22 Aug 2008 17:08 GMT > On Fri, 15 Aug 2008 20:00:15 -0400, Joshua Cranmer > <Pidgeot18@verizon.invalid> wrote, quoted or indirectly quoted someone [quoted text clipped - 5 lines] > 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 [quoted text clipped - 3 lines] > 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.
Joshua Cranmer - 02 Aug 2008 21:08 GMT > 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.
 Signature Beware of bugs in the above code; I have only proved it correct, not tried it. -- Donald E. Knuth
|
|
|