Default class for content containers


(Mark Graham) #1

Matrix Version:5.5.6.2

Hi,

We’re building a new site using bootstrap 4 and have run into the issue where the row/col relationship is failing when an editor makes a new content container but doesn’t apply a col class.

Is there a way that we can default content containers to have a class (eg. col-12) so that the row/col relationship can be preserved?

Thanks in advance.

Mark G


(Mark Graham) #2

We came up with the following solution that seems to work how we need it.
In our SCSS file we added the following:

.row {
    & div:not([class^="col"]){
        @include make-col-ready();
        @include make-col(12);
    }
}

(Harinder Singh) #3

On Styles screen of your design asset, you can also define classes with friendly names for html tags and content conatiners.

Atleast your content editors won’t have to enter the class names manually.

https://matrix.squiz.net/manuals/designs/chapters/design-asset#Styles-Screen

Another alternative is to use Content templates to fully control your layouts.


(Harinder Singh) #4

It will be nice to have this option available in User Group’s Preferences to set Default classes for Content Containers.