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 Hapani– Rohan Hapani2020-12-17 06:13:29 +00:00Commented 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– zus2020-12-17 06:14:40 +00:00Commented Dec 17, 2020 at 6:14
-
You can manage from _extend.less file.Rohan Hapani– Rohan Hapani2020-12-17 06:19:34 +00:00Commented 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– zus2020-12-17 06:23:53 +00:00Commented Dec 17, 2020 at 6:23
-
I hope you understand my point.zus– zus2020-12-17 06:34:46 +00:00Commented Dec 17, 2020 at 6:34
|
Show 2 more comments
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 blockzus– zus2020-12-17 03:04:49 +00:00Commented Dec 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;}Anton– Anton2020-12-17 08:47:08 +00:00Commented 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– zus2020-12-17 09:23:08 +00:00Commented Dec 17, 2020 at 9:23
-
All new CSS rules you write in _extend.lessAnton– Anton2020-12-18 09:17:11 +00:00Commented 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– zus2020-12-22 03:51:13 +00:00Commented Dec 22, 2020 at 3:51