Is there a code that I add to my views style tables file that will give me distinct classes for each row in a views-table? or is there a module? I am working in Drupal 6
-
distinct classes? normally class is used to specify common aspects of styles for reusability... why not use id instead?– optimusprime619Dec 20, 2012 at 21:24
-
I used group by so i have five tables on the page and each table has five rows with five different classes but they are repeated in each table. I want to be able to style a specific row in each table.– LizDec 20, 2012 at 21:35
1 Answer
I have two ideas:
1) with :nth CSS selector you can reach every row you want with your style rules. For example the third row can be selected with the selector:
.table-class .tr:nth(3) td { background: red; }
2) with jQuery
-
Thanks, I tried the nth Css selector, the only problem is that I used the group by option in the views-table so i have 5 tables on the page and it makes every third row in each table red. Is there a way to get around that?– LizDec 20, 2012 at 21:28
-
1) if your tables are identified by an id, you can easily solve with:
#table-id .tr:nth(3) td { background: red; }
2) you can use the nth selector also for the tables. example:#container .table-class:nth(2) .tr:nth(3) td { background: red; }
REMEMBER: nth isn't crossbrowser. read this article to solve that: Making nth-child Work Everywhere Dec 21, 2012 at 8:21