Welcome Guest ( Log In | Register )



2 Pages V   1 2 >  
Reply to this topicStart new topic
> CSS for tables with diferent rows
suicide
post Sep 10 2004, 03:31 PM
Post #1


Member [ Level 2 ]
Group Icon

Group: Members
Posts: 55
Joined: 7-September 04
Member No.: 351



Hi,
is there somekind of CSS style i could apply for tables to have diferent colors in diferent lines??? Separated one by one?

This way my tables will all have (for example) a red row, a yellow row, a red row, a yellow row, a red row, a yello row, etc...

If not, what can i do to achieve this?
Go to the top of the page
 
+Quote Post
overture
post Sep 10 2004, 06:02 PM
Post #2


Premium Member
Group Icon

Group: Members
Posts: 208
Joined: 6-September 04
From: England
Member No.: 315



you can make classes in CSS like this:
CODE
.red {
       background-color: red;
}
.yellow {
       background-color: yellow;
}


and for each row you want red add this to the <td>:
QUOTE
class="red"
<td class="red">

for yellow add this:
CODE
class="yellow"
<td class="yellow">
Go to the top of the page
 
+Quote Post
avalon
post Oct 27 2004, 07:07 PM
Post #3


Advanced Member
Group Icon

Group: Members
Posts: 160
Joined: 27-October 04
Member No.: 1,260



It better to place it in <tr> if you want the whole row to be color with specific color.

CODE

<style>
.background_red {
background-color: red;
}
.background_yellow {
background-color: yellow;
}
.background_blue {
background-color: blue;
}
</style>

<table cellspacing="0" cellpadding="3" border="0">

<tr class="background_red"><td>Column 1</td><td>Column 2</td><tr>
<tr class="background_yellow"><td>Column 1</td><td>Column 2</td><tr>
<tr class="background_blue"><td>Column 1</td><td>Column 2</td><tr>

</table>

Go to the top of the page
 
+Quote Post
lhunath
post Oct 27 2004, 10:05 PM
Post #4


Premium Member
Group Icon

Group: [HOSTED]
Posts: 224
Joined: 13-October 04
From: Belgium
Member No.: 1,160



CODE
tr { background: red; }
tr + tr { background: blue; }
Only standard compliant browsers, though. No buggy ones, like IE.
Go to the top of the page
 
+Quote Post
Hercco
post Oct 28 2004, 04:25 PM
Post #5


Super Member
Group Icon

Group: Members
Posts: 595
Joined: 4-September 04
Member No.: 228



QUOTE(lhunath @ Oct 28 2004, 12:05 AM)
CODE
tr { background: red; }
tr + tr { background: blue; }
Only standard compliant browsers, though. No buggy ones, like IE.
*



This is probably the most suckiest flaw in IE (at least if you don't take security into account...). With tables that have several columns making every other row different colour makes it highly more readable. But as IE doesn't suppory this and it is like 95% of people in the web using it, you gotta go with clumsy <tr class= .
Geez I hate IE...

Go to the top of the page
 
+Quote Post
r3d
post Oct 28 2004, 07:27 PM
Post #6


death
Group Icon

Group: Members
Posts: 268
Joined: 8-September 04
Member No.: 384



QUOTE(Hercco @ Oct 29 2004, 12:25 AM)
This is probably the most suckiest flaw in IE (at least if you don't take security into account...). With tables that have several columns making every other row different colour makes it highly more readable. But as IE doesn't suppory this and it is like 95% of people in the web using it, you gotta go with clumsy <tr class= .
Geez I hate IE...
*



ie 6.0 doesn't support all new property that release on css 2.1, have a 40-60% support to css 2, and 80-90% support to css1, that's why it's buggy. besides ms create its own property of css that only works on ie browser. anyone remember the colored scrollbar rolleyes.gif
Go to the top of the page
 
+Quote Post
lhunath
post Oct 28 2004, 07:45 PM
Post #7


Premium Member
Group Icon

Group: [HOSTED]
Posts: 224
Joined: 13-October 04
From: Belgium
Member No.: 1,160



One link to solve all your problems:
http://dean.edwards.name/IE7/intro/
Go to the top of the page
 
+Quote Post
r3d
post Oct 28 2004, 08:09 PM
Post #8


death
Group Icon

Group: Members
Posts: 268
Joined: 8-September 04
Member No.: 384



cool js patch for ie. i though it was a new version of ie laugh.gif
i think you don't need this coz it's not that hard to cheat ie bugs, check the alpha version of my site www.r3d.info. site is tested in ie5.5+, mozi and opera biggrin.gif
Go to the top of the page
 
+Quote Post
lhunath
post Oct 29 2004, 05:47 AM
Post #9


Premium Member
Group Icon

Group: [HOSTED]
Posts: 224
Joined: 13-October 04
From: Belgium
Member No.: 1,160



I know that, but it fixes alot more than bugs.
Only just go and look at what support it offers in IE!
http://dean.edwards.name/IE7/compatibility/

No way you can do that with CSS Hacks. This patch is the ultimate solution for MS's crap, which, normal users have to go and clean up again as usual.
Go to the top of the page
 
+Quote Post
r3d
post Oct 29 2004, 04:25 PM
Post #10


death
Group Icon

Group: Members
Posts: 268
Joined: 8-September 04
Member No.: 384



i think that's my last option, coz some ppl disable or hate js and most web users now is migrating to firefox wink.gif
Go to the top of the page
 
+Quote Post

2 Pages V   1 2 >
Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Div Tags Vs Tables For Layout(10)
  2. Table Layout Vs. Css Layout(18)
  3. Css Vs. Tables - A Reflection...(14)


 



- Lo-Fi Version Time is now: 30th August 2008 - 04:32 AM