How can I reduce div elements Drupal creates in a view block?

for exmaple I have a block created by view and I see these many divs:

<div class="block block-views" id="block-views-shortcut-link-block">
<div class="content">
    <div class="view view-shortcut-link view-id-shortcut_link view-display-id-block shortcutlink-block view-dom-id-ad495e95183a1bbbe306bd1ec4f008e4">
        <div class="view-content">
        <div class="views-row views-row-1 views-row-odd views-row-first">
            <div class="views-field views-field-title">
                <h2 class="field-content"><a href="#">aaaaaa</a></h2>
                <div class="icon">
                    <img height="87" width="89" alt="" src="http://.....png" typeof="foaf:Image">
            <div class="views-field views-field-field-shortcut-slogan">
                <div class="field-content slogan">

Are these two many div really needed? Can I reduce them by define a theme for this block?

3 Answers 3


I use Semantic Views to remove a lot of the cruft from views.

This Views plugin makes unformatted styles, field row styles and other output more readily configurable without needing to override template files. Instead of overriding row style templates for views where you want to specify different HTML elements (tags) and class attributes, you can specify these inside the Views UI and avoid overriding templates for each view.


Additionally to "Semantic Views": Fences is a an easy-to-use tool to specify an HTML element for each field. This element choice will propagate everywhere the field is used, such as teasers, RSS feeds and Views. You don't have to keep re-configuring the same HTML element over and over again every time you display the field.


As Bryan say, Semantic views it's the best option for me.

But you have another 4 options.

  1. Use Display suit to define a new display and use it to print the view. More or less you can also control the number of divs. It'll take more time than use semantic views.

  2. In views, you can configure, also more or less, how the divs are printed, check the "Style settings".

  3. You can create your own tpls to use in views, it will give you full controll of all the HTML.

  4. You can crete your own formatters for fields,also here you can not controll all de divs, only the fields divs, like in the 2º option.

  5. The last option is use the theme mothership, this theme have a configuration option that help you to clean all the drupal html, and leave only that it's required.

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.