HighDots Forums  

Re: CSS: rule for the style of a table including its rows and cells?

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss Re: CSS: rule for the style of a table including its rows and cells? in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Chris John Jordan
 
Posts: n/a

Default Re: CSS: rule for the style of a table including its rows and cells? - 09-18-2003 , 02:04 PM






Mikko Rantalainen <mira (AT) st (DOT) jyu.fi> wrote:
Quote:
Chris John Jordan wrote:
David Dorward <dorward (AT) yahoo (DOT) com> wrote:

table, tr, td, th { /* properties: values */ }

Thanks, but TMK that applies to all tables - it may not be invoke for
'/a/' table.

table.special,
table.special > tr,
table.special > tr > th,
table.special > tr > td,
table.special > thead > tr,
table.special > tbody > tr,
table.special > thead > tr > th,
table.special > tbody > tr > td
{
/* properties you want to apply */
}

However, note that MSIE doesn't support child selector ">"
Ah. I do need the solution to be MSIE compatible

Quote:
E so you may need to drop those.
Sorry to be thick, but how exactly? What I want is something that will
allow:

??? { properties for mycompletetablestyle table }
??? { properties for mycompletetablestyle table's tr }
??? { properties for mycompletetablestyle table's tr's td }
...
<table class=mycompletetablestyle>
<tr><td>A</td><td>B</td></tr>
<tr><td>C</td><td>D</td></tr>
</table>

Quote:
In that case every tr, td and th inside possible
nested tables will be selected too, which is not what you want.
I can accept that, since I'm happy to mark style on each table, including
the child tables.

Thanks.
--
Chris


Reply With Quote
  #2  
Old   
Mikko Rantalainen
 
Posts: n/a

Default Re: CSS: rule for the style of a table including its rows and cells? - 09-18-2003 , 02:21 PM






Chris John Jordan wrote:
Quote:
Mikko Rantalainen <mira (AT) st (DOT) jyu.fi> wrote:

Chris John Jordan wrote:

David Dorward <dorward (AT) yahoo (DOT) com> wrote:


table, tr, td, th { /* properties: values */ }

Thanks, but TMK that applies to all tables - it may not be invoke for
'/a/' table.

table.special,
table.special > tr,
table.special > tr > th,
table.special > tr > td,
table.special > thead > tr,
table.special > tbody > tr,
table.special > thead > tr > th,
table.special > tbody > tr > td
{
/* properties you want to apply */
}

However, note that MSIE doesn't support child selector ">"

Ah. I do need the solution to be MSIE compatible

E so you may need to drop those.


Sorry to be thick, but how exactly? What I want is something that will
allow:

??? { properties for mycompletetablestyle table }
??? { properties for mycompletetablestyle table's tr }
??? { properties for mycompletetablestyle table's tr's td }
Just drop the ">" characters. Like this:

table.special,
table.special tr,
table.special tr th,
table.special tr td,
table.special thead tr,
table.special tbody tr,
table.special thead tr th,
table.special tbody tr td
{...}

You can also remove all selectors with thead or tbody if you don't use
such elements.

Quote:
table class=mycompletetablestyle
tr><td>A</td><td>B</td></tr
tr><td>C</td><td>D</td></tr
/table

In that case every tr, td and th inside possible
nested tables will be selected too, which is not what you want.

I can accept that, since I'm happy to mark style on each table, including
the child tables.
Unfortunately, setting class of the table only isn't going to help. I
think an example says it best:

1. <table class="a">
2. <tr><td>
3. <table class="b">
4. <tr><td>
5. </td></tr>
6. </table>
7. </td></tr>
8. </table>

If you use CSS selector "table.a > tr > td" you'll select the td element
that starts on line 2. However, as I said, MSIE doesn't support child
selector so you have to use selector "table.a tr td" but it doesn't the
the same thing. Instead, that selector selects td elements that start on
lines 2 *and* 4. IF you know the table.b will be always inside table.a
you can just write another selector "table.b tr td" which correctly
overrides selector "table.a tr td" *if that declaration is later in the
CSS source*. However, if table.a can be nested inside table.b and the
other way around, the only way to correctly select td elements from only
one of the tables is going to happen only if *every* td element has it's
own class marked up in the source. Like this:

1. <table class="a">
2. <tr><td class="a">
3. <table class="b">
4. <tr><td class="b">
5. </td></tr>
6. </table>
7. </td></tr>
8. </table>

Again, this is a limitation of MSIE and as far as I know, there isn't a
nice workaround. You just have to add extra attributes to markup.

--
Mikko



Reply With Quote
  #3  
Old   
David Dorward
 
Posts: n/a

Default Re: CSS: rule for the style of a table including its rows and cells? - 09-18-2003 , 03:15 PM



Chris John Jordan wrote:

Quote:
Sorry to be thick, but how exactly? What I want is something that will
allow:

??? { properties for mycompletetablestyle table }
??? { properties for mycompletetablestyle table's tr }
??? { properties for mycompletetablestyle table's tr's td }
..mycompletetablestyle { properties for mycompletetablestyle table }
..mycompletetablestyle tr { properties for mycompletetablestyle table's tr }
..mycompletetablestyle tr td { properties for mycompletetablestyle table's
tr's td }


--
David Dorward http://dorward.me.uk/


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.