I installed one of the contributed themes and I like it, except for one tiny element, where I'd like to increase the font size. Is there a way of overriding a particular element style WITHOUT having to create a whole new subtheme?

I'm new to Drupal 8 and moved from Drupal 6, where this was easily achievable in themes I used by providing customising style elements in local.css file. In a multi-site hosting environment, I would:

- create a themes subdirectory in under /sites/my_site_1
- add local.css there
- add style definitions I wanted add/override in local.css
- clear cache.

I searched everywhere to find out if simple CSS overrides are possible in Drupal 8, but all I found was how to create new themes using, possibly, some base themes.
The overhead of doing that (providing a whole bunch of non-trivial files) seems out of proportion in comparison to such a simple change.

Am I missing something?

Thanks,
Milan

Comments

Jeff Burnz’s picture

Is there a way of overriding a particular element style WITHOUT having to create a whole new subtheme?

Yes, modify the theme. Maybe clone it first, then modify it.

wizfromoz’s picture

Thanks for the prompt reply. If I modify the theme, as you suggested in the first option, then the change will affect all sites I host that use the same theme. The other option implies a creation of the subtheme.

Maybe my question wasn't clear: is there a way of customising a theme used by more than 1 site, locally for each site?

This is what local.css allowed me to do in Drupal 6. All sites use the same theme, but then I can override certain elements (font, background colour, etc) on per site basis, without modifying the original theme.

sprite’s picture

A local.css file is a feature of a theme. Most themes have them.
Check the theme's configuration file(s) to see if it is setup with one.
The CSS loader simply needs to know that any local.css takes precedence.

spritefully yours
Technical assistance provided to the Drupal community on my own time ...
Thank yous appreciated ...

Jeff Burnz’s picture

Depends on your setup, are you doing a multisite?

If it's NOT a multisite then you would add a library with one CSS file - local.css, then load it (the library) via whatever method suites you, via the themes info file is easiest.

If it's a multisite things get more tricky and you'd probably be best to have a library per site then load the correct library in a PHP function (using some basic conditional logic).