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 am currently styling an Adsense block by inserting code in global.base.css in my module, but when I place the code in local.css, the styling is not applied. Is there an extra step that I am missing to apply CSS from local.css?
Currently, this is my workaround:
local.css:
/*
* Copy this to global.base.css after each upgrade of the Mix and Match theme
*/
#block-adsense-managed-0 {
width:728px;
margin-left:auto;
margin-right:auto;
}
Relevant part of global.base.css:
/*
* This was copied from local.css
*/
#block-adsense-managed-0 {
width:728px;
margin-left:auto;
margin-right:auto;
}
Also, I wanted to note that I am centering the block in the "help" region, though it looks like this should center the block in any region. I am using a width of 728 px because this is the width of the ad; if you are using a different block, change the width to a suitable # of pixels/ percentage width.
Comments
Comment #0.0
laboratory.mikeChanging a couple lines to make the post more readable.
Comment #1
ajross CreditAttribution: ajross commentedThe site setup with AT as the base theme won't necessarily recognize local.css the way the Fusion version did. You can set something in the .info file to add the stylesheet or you can simply tack your new styles to the end of an existing stylesheet (global.styles.css or colors.css maybe) and just be sure to add them back in after any theme updates.
I might recommend instead using the mechanism AT provides. Go into the theme config and under "Layout and General Settings" select Extensions. Select "Custom CSS" and save, and when you return to the page there will be a place for you to enter small amounts of custom CSS to override the theme's defaults.
Comment #2
laboratory.mikeThanks ajross.