0

I need to change the text color of a block on my main page. The existing theme uses blue text on a light blue background which makes it somewhat difficult to read. I used Firebug to find the div ID and created a local.css file per this post.

#block-views-team-events-calendar-block-2 .content
{
color: #ffffff;
}

I changed the color to white, but, I don't see any change on the page. I tried clearing the cache, but, I got the same results. How can I change the text color for one single block on my main page?

2

There can be multiple reasons why your styles are not applied to the page elements:

  • CSS aggregation is enabled. Disable aggregation and see if your custom CSS works. If it doesn't, you probably forgot to include the file in your theme - move to the next option.
  • CSS stylesheet is not added to the theme via THEMENAME.info file or other methods. Placement of the CSS file in your theme's css folder does not make it load while Drupal pages are loading.
  • wrong selector used
  • styles are overridden by a selector with higher specificity ...etc.

To add CSS stylesheet to the Drupal theme, add the following to the current theme's .info file and clear cache:

stylesheets[all][] = css/local.css

You can also add CSS files to your theme via drupal_add_css function that you can use in hook_preprocess_page().

Hope this helps.

  • Thanks. My problem was resolved by updating the theme's info file as you suggested. – rrirower May 20 '16 at 20:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.