#attached css in render array not working I am trying to render a block with a custom css with it. I have obtained a render array for the block and now I add to it:

$render_array['#attached']['css'] = array(
   base_path() . 'path/to/module/css/abcd.css',
);

return drupal_render($render_array);


The path to the css file is correct, I am able to access it in the browser. However, the css styles are not applied to the block. What are the proper steps to take now to debug this problem?

Thanks in advance!

Edit:
I have tried out Option 1, this is the result of dpm($block) in in the hook_block_view.

subject (String, 15 characters ) Correct subject
content (Array, 2 elements)

  #markup (String, 45 characters ) &lt;span class="testtest"&gt; Red text &lt;/span&gt;
  #attached (Array, 1 element)
    css (Array, 1 element)
        0 (String, 58 characters ) /path/to/css


And the contents in the css file:

.testtest {
  color: #C43C55;
} 


Could it be a site configuration? Thanks!
You are saying, you have already rendered content array for the block and after that you are adding css to this block. If block array is already rendered then where you are applying this css because array is already rendered for you. Now you have two options here.

Option 1: Add custom CSS to your block
It should be something like this.

function foo_block_view($delta = '')
{
  if($delta == 'foo_delta')
  {
    $block = array
    (
      'subject' =&gt; t('Foo title'),
      'content' =&gt; array
      (
        '#markup' =&gt; '&lt;p&gt;' . t('Lorem ipsum text.') . '&lt;/p&gt;',
        '#attached' =&gt; array
        (
           'css' =&gt; array('path/to/my.css'),
        ),
      ),
    );
    return $block;
  }
}


Option 2: Add custom CSS to your page before this block rendered (Not a great option for your case).

$content = array();
$content['#attached']['css'] = array(
  $path . 'my.css' =&gt; array(
      'group' =&gt; CSS_AGGREGATE_THEME,
      'weight' =&gt; 999
    ),
  );
return $content;