How to add an HTML block with a custom .css

Permalink
I have a single block that is customized and requires it's own reference to a .css file.

When I import the code and reference the .css it messes up the entire site.

How do I properly embed the html and use it's custom .css in a block?

 
siton replied on at Permalink Reply
siton
"css it messes up the entire site. " This is most of the time CSS conflicts, cascading and styles with the Theme level CSS (names, resets and so on). This is not CMS/PHP problem.

"HOW TO ADD" Its really easy to Automatically including CSS and JavaScript in Custom Templates:
http://documentation.concrete5.org/developers/working-with-blocks/w...

Anyway its better to use view.css only for small specific code you need for the specific block:
1. get-specific-css-styles (Do not use not specific selectors like: a, p, div. *, span)
Read more her:
http://www.sitepoint.com/get-specific-css-styles/...

2. Do not use view.css for "Theme level" css (dont use another version of boostrap for example and/or resets and so on). Bad also for performance.

Look at the core blocks view.css examples (you see very small and specific Css code)

Another "safe" option is do not use view.css and change custom template selectors (the view.php markup) - and add/edit styles in your theme level (your main css for the entire site).
("btn btn-primary" in you view.php will use link href: boostrap.css from the theme level)