teaser styles is not coming fine after adding less file.

sunitac70336244

24-12-2018

Dear All,

One of my requirement for adding the styles to the teaser is as below. The teaser background color should be blue , as shown in below figure.

1653572_pastedImage_0.png

For this I have created the hometeaser.less file with the below contents.

/* MCK teaser home */

.cmp-teaser--home {   

.cmp-teaser{

        .cmp-teaser__title {

       background-color: #054C70;

        }

        .cmp-teaser__description {

            font-family: @font-family-serif;

        }

    }

}

I have added this hometeaser.less file to my teaser.less file , as shown below

1653573_pastedImage_19.png

Then I have added the policy and style in my editable template , as shown below.

1653574_pastedImage_20.png

But After that also , background color is not coming , as shown below. Can you please help me on this.

1653582_pastedImage_23.png

Accepted Solutions (1)

Accepted Solutions (1)

Gaurav-Behl

MVP

24-12-2018

Are you not able to see the style-brush or the style option "HomeTeaser" itself or otherwise the changes are not visible after applying the style option?

Use developer toolbar to validate the generated DOM structure. It should be something similar to mentioned below as Style System follows the descendant selector convention:

<div class="cmp-teaser--home">  // wrapper class

     <div class="cmp-teaser">   // component specific class

          <div class="cmp-teaser__title">..... </div>

          <div class="cmp-teaser__description">..... </div>

     </div>

</div>

Validate that the generated css has classes ".cmp-teaser--home .cmp-teaser .cmp-teaser__title {...}" and ".cmp-teaser--home .cmp-teaser .cmp-teaser__description {...}"

For displaying background color use:

/* MCK teaser home */

.cmp-teaser--home {  

.cmp-teaser{

     background: color_code_in_HEX;

        .cmp-teaser__title {

       background-color: #054C70;

        }

        .cmp-teaser__description {

            font-family: @font-family-serif;

        }

    }

}

References: