Add CSS style for a block into the same block

This simple code can be pasted into a PHP filtered block (or into a block declared by a module) to set some style from a block into the block container itself.

This code is placed on html head, applied only to the pages where block appears, without touching css optimization. If you want to include an external CSS file instead, use drupal_add_css instead: in any case you can exclude this file for aggregation, setting $preprocess attribute to FALSE.

drupal_add_css

If block appears in very few pages, and it can change quickly (e.g. a banner with custom styles on home page), using drupal_set_html_head could be the best way, even according to Yahoo Performance Best Practices. In other cases, use drupal_add_css.

Yahoo Performance Best Practices

See also:

https://web.archive.org/web/20090729000000*/http://api.drupal.org/api/function/drupal_add_css/6

https://web.archive.org/web/20090729000000*/http://developer.yahoo.com/performance/rules.html#external

https://web.archive.org/web/20090729000000*/http://api.drupal.org/api/function/drupal_set_html_head/6

https://web.archive.org/web/20090729000000*/http://api.drupal.org/api/function/drupal_add_css/6

https://web.archive.org/web/20090729000000*/http://developer.yahoo.com/performance/rules.html#external

Proxied content from gemini://chirale.org/2009-07-29_358.gmi (external content)

Gemini request details:

Original URL
gemini://chirale.org/2009-07-29_358.gmi
Status code
Success
Meta
text/gemini; charset=utf-8
Proxied by
kineto

Be advised that no attempt was made to verify the remote SSL certificate.