![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I am trying to create a Zebra table where each Zebra "Strip" consists of two rows. I am using a classical table to create the Zebra table. In my CSS, I have .dark { background-color: #00FFFF; } .light { background-color: #CCFFFF; } tr class="light " td class="name">Name</td td class="addr">Street</td td class="email">Email</td td class="interest">Interests</td /tr tr class="light " td>Spouse</td td>Telephone</td td>Spouse Email</td td>Spouse Interests</td /tr tr class="dark" td class="name">Joe</td td class="addr">Elm</td td class="email">Something</td td class="interest">More</td /tr tr class="dark" td>Jane</td td>999 999-9999</td td>Something Email</td td>Something Interests</td /tr I would to wrap the two rows in a single definition, like with a <div> or a <span> but having been able to make that work. div class="light" tr td class="name">Name</td td class="addr">Street</td td class="email">Email</td td class="interest">Interests</td /tr tr class="light " td>Spouse</td td>Telephone</td td>Spouse Email</td td>Spouse Interests</td /tr /div div class="dark" tr td class="name">Joe</td td class="addr">Elm</td td class="email">Something</td td class="interest">More</td /tr tr class="dark" td>Jane</td td>999 999-9999</td td>Something Email</td td>Something Interests</td /tr /div Appreciate your help. Thanks... Bruce |
#3
| |||
| |||
|
|
"Bruce A. Julseth" <julebj_nospam (AT) bellsouth (DOT) net> wrote in message news:gNKjk.709$XT1.505 (AT) bignews5 (DOT) bellsouth.net... I am trying to create a Zebra table where each Zebra "Strip" consists of two rows. I am using a classical table to create the Zebra table. In my CSS, I have .dark { background-color: #00FFFF; } .light { background-color: #CCFFFF; } tr class="light " td class="name">Name</td td class="addr">Street</td td class="email">Email</td td class="interest">Interests</td /tr tr class="light " td>Spouse</td td>Telephone</td td>Spouse Email</td td>Spouse Interests</td /tr tr class="dark" td class="name">Joe</td td class="addr">Elm</td td class="email">Something</td td class="interest">More</td /tr tr class="dark" td>Jane</td td>999 999-9999</td td>Something Email</td td>Something Interests</td /tr I would to wrap the two rows in a single definition, like with a <div> or a <span> but having been able to make that work. div class="light" tr td class="name">Name</td td class="addr">Street</td td class="email">Email</td td class="interest">Interests</td /tr tr class="light " td>Spouse</td td>Telephone</td td>Spouse Email</td td>Spouse Interests</td /tr /div div class="dark" tr td class="name">Joe</td td class="addr">Elm</td td class="email">Something</td td class="interest">More</td /tr tr class="dark" td>Jane</td td>999 999-9999</td td>Something Email</td td>Something Interests</td /tr /div Appreciate your help. Thanks... Bruce I think I found the solution.. Adding span.dark tr { background-color: #00FFFF; } span.light tr { background-color: #CCFFFF; } seems to be doing the trick.. Thanks... |
#4
| ||||
| ||||
|
|
"Bruce A. Julseth" <julebj_nospam (AT) bellsouth (DOT) net> wrote in message news:gNKjk.709$XT1.505 (AT) bignews5 (DOT) bellsouth.net... tr class="light " td class="name">Name</td td class="addr">Street</td td class="email">Email</td td class="interest">Interests</td /tr tr class="light " td>Spouse</td td>Telephone</td td>Spouse Email</td td>Spouse Interests</td /tr |
|
tr class="dark" td class="name">Joe</td td class="addr">Elm</td td class="email">Something</td td class="interest">More</td /tr tr class="dark" td>Jane</td td>999 999-9999</td td>Something Email</td td>Something Interests</td /tr |
|
div class="dark" tr td class="name">Joe</td td class="addr">Elm</td td class="email">Something</td td class="interest">More</td /tr tr class="dark" td>Jane</td td>999 999-9999</td td>Something Email</td td>Something Interests</td /tr /div |
|
I think I found the solution.. Adding span.dark tr { background-color: #00FFFF; } |
#5
| |||
| |||
|
|
Bruce A. Julseth schrieb: "Bruce A. Julseth" <julebj_nospam (AT) bellsouth (DOT) net> wrote in message news:gNKjk.709$XT1.505 (AT) bignews5 (DOT) bellsouth.net... tr class="light " td class="name">Name</td td class="addr">Street</td td class="email">Email</td td class="interest">Interests</td /tr tr class="light " td>Spouse</td td>Telephone</td td>Spouse Email</td td>Spouse Interests</td /tr Looks like these are header cells. So use the th element! tr class="dark" td class="name">Joe</td td class="addr">Elm</td td class="email">Something</td td class="interest">More</td /tr tr class="dark" td>Jane</td td>999 999-9999</td td>Something Email</td td>Something Interests</td /tr It can/will be difficult for a screen reader user to find out which column header cells belong to which data cell. You can associate them via td/@headers and th/@id. div class="dark" tr td class="name">Joe</td td class="addr">Elm</td td class="email">Something</td td class="interest">More</td /tr tr class="dark" td>Jane</td td>999 999-9999</td td>Something Email</td td>Something Interests</td /tr /div Neither can div be a parent element of tr, ... I think I found the solution.. Adding span.dark tr { background-color: #00FFFF; } ... nor can span. However, tbody can. -- Johannes Koch In te domine speravi; non confundar in aeternum. (Te Deum, 4th cent.) |
#6
| |||
| |||
|
|
Thanks for the suggestion on using <th>. I've never used tbody so I'll have to study how to use it, as well as td/@headers and th/@id. |
#7
| |||
| |||
|
|
I am trying to create a Zebra table where each Zebra "Strip" consists of two rows. |
#8
| |||
| |||
|
|
"Bruce A. Julseth" <julebj_nospam (AT) bellsouth (DOT) net> wrote in message news:gNKjk.709$XT1.505 (AT) bignews5 (DOT) bellsouth.net... I am trying to create a Zebra table where each Zebra "Strip" consists of two rows. No need to set the classes on all the <tr>s, just the odd ones is enough. Style the <td>s not the <tr>s. .... |
#9
| |||
| |||
|
|
In article <g6o4ls$k30$1 (AT) registered (DOT) motzarella.org>, "Nik Coughlin" <nrkn.com (AT) gmail (DOT) com> wrote: "Bruce A. Julseth" <julebj_nospam (AT) bellsouth (DOT) net> wrote in message news:gNKjk.709$XT1.505 (AT) bignews5 (DOT) bellsouth.net... I am trying to create a Zebra table where each Zebra "Strip" consists of two rows. No need to set the classes on all the <tr>s, just the odd ones is enough. Style the <td>s not the <tr>s. ... As Nick shows, it is easy enough to implement with just css. Depending on the nature of your table - how much would be lost if there were no stripes if js were disabled or unavailable in rare cases - you might also consider a javascript solution. It saves a lot of bother if the table is big and changes a lot or if it is generated via php from csv files on the server. There is an example of this at http://khs.org.au/historian_database/tz.html> and the js at http://khs.org.au/historian_database/table_row_stripe.js You would need to adapt to your two rows at a time requirements. -- dorayme |
#10
| |||
| |||
|
|
"dorayme" <doraymeRidThis (AT) optusnet (DOT) com.au> wrote in message You would need to adapt to your two rows at a time requirements. I do have frequent changes which make updating the table a 'bear!' So the JS suggestion is welcomed. I had read about it somewhere. Thank to pointing me to an example. |
![]() |
| Thread Tools | |
| Display Modes | |
| |