I have a content type called Advertisement on my Drupal site. I want to add some custom css functionality to this content type (as in, when I create an advertisement from the "Add Content" button, it should have the css I want).

I am using the Asset injector module to insert the css. Here is what it looks like: enter image description here

These are the conditions I have specified in the injector:

enter image description here

However, if I try to create an advertisement, my css changes do not get reflected. enter image description here

Would anyone happen to know why the asset injector module isn't injecting my css? I've tried clearing the cache but that did not do the trick.

  • Have you ensured asset injector has added a reference to that CSS in a generated file into the page header on the given page?
    – cilefen
    Dec 21, 2022 at 22:29
  • stupid question but are you sure the content type is advertisement_link_class_ looks like there is an extra "_"
    – taggartJ
    Dec 21, 2022 at 23:52
  • @taggartJ The content type is advertisement link class. Those underscores are just the machine name of the content type. Dec 22, 2022 at 5:56
  • @cilefen Sorry, I don't quite understand what you mean by that. If you mean that the Preprocess CSS field for the injector has been checked, then, yes, it has been enabled. Dec 22, 2022 at 5:58
  • I am asking if asset injector has actually inserted a reference to your CSS onto those pages. The CSS you wrote may not be working for other reasons.
    – cilefen
    Dec 22, 2022 at 11:28

1 Answer 1


Usually, there are 2 themes being used on a Drupal site, one for the "public" side (default theme), and the other for "backend" content (admin theme). You have to figure out which theme you want your custom CSS to be added to.

In your question, the screenshot is showing a page through which new content is being added, and it seems by its design that the theme being used is one of the admin themes.

You are probably using the option Use the administration theme when editing or creating content. You can find that option on the Administration > Appearance page /admin/appearance.

Asset Injector is most likely adding the CSS to the default theme, not the admin theme.

In your case you can turn off the mentioned option. This way you will see the default theme when creating new content, and get the custom CSS, but you may not be happy with the look of other elements on the page, depending on the form styles in your default theme.

Or you can check if Asset Injector has the option which theme to add the CSS to. If you can make it add to the admin theme you can continue to use the admin theme for creating/editing content.

Your Answer

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

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