When I create new block drupal auto create this html tags and default css class for block content:

<div class="content-block"></div>

now i need to edit css/class like this:

<div class="content-block2"></div>
<div class="content-block3"></div>
<div class="content-block4"></div>

It is possible? If YES, How To?

  • 1
    Where would your incrementation come from (block2, block3...) ? Anyway, I'd advise you to try Block Class Module, for usability. – Gregory Kapustin Dec 11 '12 at 13:39

you can also use Block Class Module to manually add classes to each of your block.

| improve this answer | |

You can override the template for the block.

To see what the template should be you can use the following in your themes template file.


function YOURTHEME_preprocess_block(&$vars) {

Also make sure you have a copy of block.tpl.php in your themes template folder. You can get this by going to /modules/block/ and copying the file to /sites/all/themes/YOURTHEME/templates.

This is handy because you can copy the code from the default block template to your custom block template and make any changes you want there. If you were to delete your custom block template it will default back.

Heres more on template (theme hook) suggestions http://drupal.org/node/1089656

| improve this answer | |

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.