[SalesForce] Import CSS not working in Static Resource

I am trying to import CSS within a CSS file, from a static resource folder. But it shows an error and none of the style in displayed on page.

enter image description here

Also, the folder is not displayed in Source folder in Chrome Console. Although, I have added the importCSS folder in the same directory as of css folder.

Best Answer

It seems your path is not correct. When you use a css from static resources in VF page the code will look like this <apex:stylesheet value="{!$Resource.stylesheet_red}"/>. The equivalent html code is something like this <link href="/resource/1235794002000/stylesheet_red" rel="stylesheet" type="text/css"/>.

I think what you can do is use <apex:stylesheet and get the equivalent path /resource/XXXXXXXX/ and try to use this path in css file to import other css. I hope this will work. Please test and let me know.

Related Topic