0

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

2
  • distinct classes? normally class is used to specify common aspects of styles for reusability... why not use id instead? Dec 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.
    – Liz
    Dec 20, 2012 at 21:35

1 Answer 1

1

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

2
  • 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?
    – Liz
    Dec 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.