*In my custom block I want to add custom stylesheet to display the block as like i want. How it can be possible.
Asked
Active
Viewed 468 times
1 Answers
1
First, you should add the css file:
Add next line inside your module's layout file or inside your theme
local.xmllayout file (example path for the rwd theme:app/design/frontend/rwd/default/layout/local.xml):<default> <reference name="head"> <action method="addCss"><stylesheet>css/custom.css</stylesheet></action> </reference> </default>Create file inside the skin folder of your theme:
skin/frontend/<package>/<theme>/css/custom.cssThen you should add an unique identifier for your block (block's template). For that purpose use the
idorclassattributes. Detect the template file (.phtml) and add something like this:<div id="my-own-block-unique-identifier"> <!-- other content here --> </div>Next, write your css rules in the created css file using the unique identifier like this:
#my-own-block-unique-identifier { color:red; }
Siarhey Uchukhlebau
- 15,957
- 11
- 54
- 83
-
Thanks .. Its works. – Nasrin Nabim Aug 09 '16 at 12:18
-
@NasrinNabim If it works, please, mark the answer as solution – Siarhey Uchukhlebau Aug 09 '16 at 12:32