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.– Rohan HapaniDec 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?– zusDec 17, 2020 at 6:14
-
You can manage from _extend.less file.– Rohan HapaniDec 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?– zusDec 17, 2020 at 6:23
-
I hope you understand my point.– zusDec 17, 2020 at 6:34
1 Answer
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– zusDec 17, 2020 at 3:04
-
1You 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;}
– AntonDec 17, 2020 at 8:47 -
Instead of overwrite ( _theme.less ) i have created _extend.less file, shall i include inside the _extend.less file?– zusDec 17, 2020 at 9:23
-
-
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.– zusDec 22, 2020 at 3:51