0

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

7
  • You can't able to assign specific file for specific cms block. You need to manage it by parent class hierarchy. Commented 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? Commented Dec 17, 2020 at 6:14
  • You can manage from _extend.less file. Commented 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? Commented Dec 17, 2020 at 6:23
  • I hope you understand my point. Commented Dec 17, 2020 at 6:34

1 Answer 1

0

You can add it as HTML from admin panel:

<link href="http://test.com/media/examples/link-element-example.css" rel="stylesheet">
6
  • 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 Commented 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;} Commented 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? Commented Dec 17, 2020 at 9:23
  • All new CSS rules you write in _extend.less Commented 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. Commented Dec 22, 2020 at 3:51

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.