I'm trying to archieve something that looks very easy for me, but I can't find the solution. I'm using drupal 9, bootstrap 3 subtheme.

I have a region (region-buttons) that has multiple blocks.

  set classes = [
    'region-' ~ region|clean_class,
{% if content %}
  <div{{ attributes.addClass(classes) }}>
    {{ content }}
{% endif %}

For every 3 blocks inside the region, I want to add a div around as a wrapper (to add some custom styling). How can I archieve that?

Where is the "content" of the region created? (I know that I can change the layout of the blocks, but that looks to early for me.).

  • Another approach to solve this is to create as many different regions as you need (they come with their own class). Then it's easy to move the Blocks through the interface into different regions and so you have them in different divs.
    – prkos
    Oct 26, 2020 at 21:24
  • You could target every 3rd block with CSS .class-name:nth-child(3n) { ... }
    – No Sssweat
    Oct 27, 2020 at 0:06


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.