I have created custom theme which is inherit from blank theme, How to add external css for specific cms block in Custom theme?

  • You can't able to assign specific file for specific cms block. You need to manage it by parent class hierarchy. Dec 17, 2020 at 6:13
  • Can you pls give me the suggestion, i just added inline css for cms block, how to handle in single css file?
    – zus
    Dec 17, 2020 at 6:14
  • You can manage from _extend.less file. Dec 17, 2020 at 6:19
  • Okay, for eg. i have class "<div class="container">" all my cms block have the same name i mean "class="container" how to handle this situation?
    – zus
    Dec 17, 2020 at 6:23
  • I hope you understand my point.
    – zus
    Dec 17, 2020 at 6:34

1 Answer 1


You can add it as HTML from admin panel:

<link href="http://test.com/media/examples/link-element-example.css" rel="stylesheet">
  • You mean inside the CMS block right, if supposed my css files under custom theme web/css then how to include into my CMS block
    – zus
    Dec 17, 2020 at 3:04
  • 1
    You can add class wrapper for each CMS block if you want to use CSS from your theme. For example content for cms-block-1: <div class="cms-block-1">[content]</div>. And global less file like _theme.less should have similar CSS rule .cms-block-1 {color: red; border: green;}
    – Anton
    Dec 17, 2020 at 8:47
  • Instead of overwrite ( _theme.less ) i have created _extend.less file, shall i include inside the _extend.less file?
    – zus
    Dec 17, 2020 at 9:23
  • All new CSS rules you write in _extend.less
    – Anton
    Dec 18, 2020 at 9:17
  • Finally done. add css inside _theme.less under app\design\frontend\Myrwd\mytheme\web\css\source\ _theme.less the css style will apply on CMS Block. I didn't call css path inside my cms block but the css applied.
    – zus
    Dec 22, 2020 at 3:51

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.