3

All the sites I have seen that build on drupal looks like it's hit by div soup. There are so many unused divs produced by the content and some templates I have looked on contribute more by adding even more terrible markup.

I know most people with some knowledge about drupal know about this issue. For instance, here is a dump from drupal.org:

screen dump showing div soup

So why does Drupal need all these divs? Is there any rational behind them or is it just a flawed design?

Is there anything that could be done with this issue or are there some plans to improve on all these divs? Maybe a module that remove the divs that are not required and append the class statements so that markup will look better?

Are there some modules or solution that tries to address this annoying issue?

  • Usually, a table-less theme needs to use some container tags, to build content. – kiamlaluno Apr 29 '11 at 14:10
  • 5
    It may not look pretty, but it allows for great flexibility. Personally I've found that most of the divs and classes generated have been useful at some stage – Jeremy French Apr 29 '11 at 14:52
  • Making/using a custom theme or override themable output would be the only way. Personally, I made an HTML5 theme from scratch for a customer and am quite happy of the result because it drastically reduced the tags soup and even dynamic pages have a proper yet lightweight semantic, so it's possible to reduce the soup if you're willing to take the time to make a theme (or find one that you like). – wildpeaks Apr 29 '11 at 15:47
1

If you want to output a particular page element without burying it in DIVs, you can always put the relevant tag or print render() statement inside a strip_tags() function. Admittedly, this is a bit of a kludge, but it works for many common cases.

9

This is the result of a flexible content management that tries to be everything to everyone. Adding more divs upon request would be difficult, so it provides everything anyone will ever need.

Every template can be overridden as you see fit. For an example of a theme that really clears out a lot of cruft, see Mothership.

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.