I have a view set up with a block display. Its style is set to HTML list, which it does with no problem. But it doesn't seem to be applying the CSS class listed in the setup. What do I need to do to get this to apply?

enter image description here

Edited to add: Drupal 6, Views2

  • EmmyS - can you provide more information on how you can confirm that the class isn't being displayed correctly? Is it not showing up for you in firebug, view-source, etc?
    – schnippy
    Jan 27, 2012 at 17:02
  • Sorry; yes. Tried view-source, Firebug, and Chrome's inspect element. Don't see the class being added anywhere.
    – EmmyS
    Jan 27, 2012 at 17:38

4 Answers 4


I said IF its D7 bc I could not find what version. I was reading it on my phone. But here's your Drupal 6 answer:

But here's the template suggestions for D6: http://drupal.org/node/1089642

You can download devel module to get template suggestions as well.


Download this module to add css classes to specific blocks:



Don't know if this will work but it's what I've done on occasion:

Remove the css class name in your view. That should cause Drupal views to automatically add the class ".view-sessions-by-track" which should be easy to track down.

  • Nope; didn't seem to work.
    – EmmyS
    Jan 27, 2012 at 21:11

You can do theme overrides in D6 too. Just look up the specific syntax for the API & replace it w/ that. There really isn't a big diff between D6 & D7. It's just naming conventions, a few processes, & hooks.

Wait til D8 comes out in 12 months. No more php template. It's going to Twig.


If its Drupal 7 you need to theme your blocks. You can override that by creating a block.tpl.php file & place it where your html.tpl.php file resides.

Next goto http://drupal.org/files/issues/Core_templates_and_suggestions.pdf to see what template suggestions you might need. You can also search drupal.org for more, bc your block.tpl.php file might be named block--%--.tpl.php < % denotes wildcard.

Next you will have to theme you block. You can control the HTML output with the $output variable, as well as classes and ID's. You have the option of generating classes and UD's statically or dynamically.

You could also do a theme preprocessing function (your_site_name HTML &vars function) in the template.php file.

Example for block.tpl.php

/* more code here, below outputs whatever you code here */

$output .= '' . $links['title'] . ''";

  • My original post is very clearly tagged as version 6, and even states it in the post text. Why propose a solution that only works on 7?
    – EmmyS
    Nov 20, 2012 at 15:42

Your Answer

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

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