Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I just need to adjust the height css for the header. I made a "custom.css" file and added my changes but it doesn't take effect.
Comments
Comment #2
mermentau CreditAttribution: mermentau commentedThe best way is to use a sub-theme. I have some documentation on that here.
Comment #3
fehin CreditAttribution: fehin commentedI have to subtheme just to add two lines of css? That's a lot.
Comment #4
mermentau CreditAttribution: mermentau commentedEither that or learn how .css files are added in Drupal 8 and then make that adjustment every time the theme is updated.
Comment #5
Akshay kashyap CreditAttribution: Akshay kashyap as a volunteer and at gai Technologies Pvt Ltd for gai Technologies Pvt Ltd commentedHello @fehin In Drupal 8, you need to define a "library" to add your custom CSS/JS.
The general steps for loading assets (CSS/JS) are:
1.Save the CSS or JS to a file.
2.Define a "library", which can contain both CSS and JS files.
You Need to create a separate *.libraries.yml and declare it in your theme's *.info.yml file.
If your theme is named "smart", then the file name should be smart.libraries.yml
Attaching to all pages:
To attach a library to all the pages on the site that use your theme, declare it in your theme's *.info.yml file.
name: smart
type: theme
core: 8.x
libraries:
- smart/cuddly-slider
Defining a library
cuddly-slider:
version: 1.x
css:
theme:
css/cuddly-slider.css: {}
Here is a link you can check https://www.drupal.org/docs/8/theming-drupal-8/adding-stylesheets-css-an...
Comment #6
Akshay kashyap CreditAttribution: Akshay kashyap as a volunteer and at gai Technologies Pvt Ltd for gai Technologies Pvt Ltd commentedComment #7
meghasharma CreditAttribution: meghasharma as a volunteer and at QED42 for Drupal India Association commentedComment #8
meghasharma CreditAttribution: meghasharma as a volunteer and at QED42 for Drupal India Association commentedThis comment resolves the issue . Looks good to me .