1

In Drupal 7 using Views 7.x-3.3, I've specified a CSS class for the view under Advanced -> Other -> CSS class. I have my CSS class defined in my custom theme CSS file as...

TABLE.listView { border: 0; border-spacing: 0; margin: 10px 0; width: 100%; }

but the view is not using the class. When I look in FireBug I see it using a class "views-table cols-5". If I overwrite that class in FireBug with the one I created in the theme, the view table is styled the way I want it to look. How can I get views to use the CSS class I've specified? All I'm trying to do is get the table styled the way I want it to look.

  • if you look via FireBug "up a couple divs" does your class show up? meaning, Views adds that class in the very very beginning of its output, and you might just not be cascading it down enough... – Jimajamma Apr 10 '12 at 16:32
  • Yes it is up a couple divs: <div class="view view-document-library view-id-document_library view-display-id-page listView view-dom-id-3fa26a2967f6fa39b7e3ca1da3f8df22"> then <div class="view-content"> then <table class="views-table cols-5">. The class for the table tag "views-table cols-5" is where I can put in my class listView and have the table rendered correctly. So it looks like the CSS class for the view sets the class for everything that makes up the view: title, filters, table, etc. Any ideas on CSS that would work knowing that? – John81 Apr 10 '12 at 17:07
3

Given the commentary above, all you should need to do is cascade your class/table, eg, something along the lines of...

.listView table {
  border: 0;
  border-spacing: 0;
  margin: 10px 0;
  width: 100%;
}
  • My lack of basic CSS knowledge gets me again. I didn't have the class defined correctly. Thanks for your help! – John81 Apr 10 '12 at 17:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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