1

I'm attempting to edit the template for my pages to allow it to show the content with a block beside it rather than beneath it. I'm currently using bootstrap to lay out my grid.

In my page.tpl.php I have

<div class="container">
<div class="col-lg-9">
    <?php print render($page['content']); ?>
</div>
<div class="col-lg-3">
    <?php print render($page['sideblock']); ?>
</div>
</div>

I want the content block and the sideblock to be side by side. However when the page renders it wraps the content block in

<section id="block-system-main" class="block block-system clearfix">

I noticed that when I removed the clearfix class to the section tag I was able to display it side by side. But I don't see any method to remove the clearfix class from this.

2

This could easily be solved with jQuery, but I too would prefer to simply stop it from rendering.

Jquery: $('#block-system-main').removeClass('clearfix');

Rendering: Of course, you could rename the modules/system/region.tpl.php file to 'region--content.tpl.php' and put it in your sites/all/themes/YOURTHEME folder, then remove the "$classes" variable.

  • That worked great! I've actually been searching for a way to remove the classes from other regions as well, this helps immensely. – Matt Jul 15 '15 at 19:14
3

For Drupal 8, the best approach for this is to just copy the bootstrap/block/block.html.twig template from the bootstrap theme into your custom themes folder, and just remove the 'clearfix' class from the twig classes block.

block.html.twig template

2

It's hard to tell without a link to the specific page. But try this, a CSS only solution:

#block-system-main.clearfix:after {
    display: inline;
    clear: none;
}

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.