Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: Alternating colors for HTML Table's

by hawtin (Prior)
on Sep 06, 2007 at 14:17 UTC ( #637434=note: print w/replies, xml ) Need Help??

in reply to Alternating colors for HTML Table's


Personally I don't like setting format in the HTML, I find it easier to manage in the stylesheet.

In site.css: .row_2 { background-color: #f4f4f4; } .row_1 { background-color: #ffffff; } In ... print "\@import url(/site.css);\n"; my $num_rowtypes = 2; ... my $count = 0; for(my $i=0;$i<=$#{$items_list};$i++) { print "<tr class=\"row_${count}\">". "<td class=\"pos\">".($i+1)."</td>\n"; foreach my $col ("art","tit","yer","cht") { my $val = link_to($cat,$page,$col,$nam); print "<td class=\"$col\">".$val."</td>\n"; } print "</tr>\n"; $count++; $count = 0 if($count == $num_rowtypes); }

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://637434]
[james28909]: i have thught about this and though about it lol
[james28909]: also remember, that if 'Today' is may 1, then Yesterday is not may 31 lol
[james28909]: theoretically speaking ofcourse
[james28909]: so if you subtracting as you loop, be aware that you will eventually be subtracting into a past month, or year <.<
[james28909]: dontcha love it!
[james28909]: Today would be scalar localtime. Yesterday would be scalar localtime - 1. sunday - monday would variate scalar localtime - ?

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2017-04-29 03:53 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (531 votes). Check out past polls.