For example - I have enabled Zircon as my default theme. I want the user menu account to appear on left. I want to add a custom CSS file where I can write a CSS elements and add to a default theme on site.

  • 1
    You can define your own library and attach it via hook_page_attachments or you can alter the theme's library and add your css in there.
    – user21641
    Commented Feb 17, 2016 at 9:13

2 Answers 2


In Drupal 8, stylesheets (CSS) and JavaScript (JS) are loaded through the same system for modules (code) and themes, for everything: asset libraries. Asset libraries can contain one or more CSS assets, one or more JS assets and one or more JS settings.

More details on https://www.drupal.org/developing/api/8/assets


Add your custom CSS file to themes/zircon/css/ lest suppose your file name is yourfile.css, then open zircon.libraries.yml and add your Css file name to end of this section

   includes/bootstrap/css/bootstrap.css: {}
   includes/bootstrap/css/bootstrap-theme.css: {}
   includes/fonts/oswald_regular/stylesheet.css: {}
   includes/fontawesome/css/font-awesome.min.css: {}
   includes/slick/slick/slick.css: {}
   includes/slick/css/style.css: {}
   includes/monokai/monokai.min/css: {}
   includes/flexslider/flexslider.css: {}
   css/html.css: {}
   css/page.css: {}
   css/block.css: {}
   css/view.css: {}
   css/slideshow.css: {}
   css/responsive.css: {}
   css/print.css: { media: print }
   css/yourfile.css: {}

save and close the file and clear the cache.

  • adding a css file name in zircon.libraries.yml is giving an error-The website encountered an unexpected error. Please try again later.
    – 39467
    Commented Feb 17, 2016 at 11:59
  • @NewBorn-Drupalist try with put space after colon ` css/yourfile.css: {}`
    – Yuseferi
    Commented Feb 17, 2016 at 13:26
  • this is bad advice. Composer will delete edits on the next update if Zircon is a contrib theme.
    – mevsme
    Commented Sep 26, 2023 at 12:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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