How can I add a class to a title of a view?

by philalonso   Last Updated December 21, 2017 15:07 PM

I'd like to add a class to the title (H1) of a view, so that a specific style could be applied. This is Drupal 6 with a Zen subtheme.


Tags : views 6 theming zen

Answers 4

  • Go to Theme Information in your view.
  • Copy the code for the entire view in the top level template.
  • Create a file named after the most specific suggestion with this code inside in your theme's template folder.
  • Add your class to the H1 element.
  • Style to your heart's content in your theme's CSS.
March 23, 2012 08:22 AM

In the view rewrite the output of title as

<div class="H1">[title]</div> 

then u can do the styling properties for this H1 in your CSS file easily.

May 22, 2012 18:52 PM

If you're using Views 3, you should be able to click on Style Settings on the field, Customize field HTML. From there, you can set H1 as the HTML element or click on "Create a CSS class" to add a class.

enter image description here

October 04, 2012 08:24 AM

Simply you can do with

<div id="my_custom_class">my title</div>

another way need to overwrite template files of that view

Ajay Gadhavana
Ajay Gadhavana
December 21, 2017 14:12 PM

Related Questions

Use a custom view for the front page without alias

Updated February 28, 2017 23:07 PM

7-views display filters in other formats

Updated July 24, 2015 14:03 PM