Styling plugin's configuration form via CSS

Hi.

I’m redesigning the configuration form for a plugin I’d created, and would like to add some styling to parts of it. I can, of course, add online style to any element, but I would rather have an external CSS and use that.

I’ve tried creating a CSS file and putting it into plugin/views/admin/css folder, calling it style.css or pluginname.css, but to no effect.

So, I was wondering if is there actually a way to achieve the result. Any hint will be precious, thanks in advance.

There’s no automatic loading of CSS for the configuration form.

You have two options to do this that I can think of:

  1. Load the CSS in the admin_head hook.
  2. Put a <link> tag directly in the content of the configuration form. This is legal in HTML5.

Thanks, John.
I am not so sure on option 2, as from what I understand the <link> tag should be put inside the <head> section to avoid reloading style rules, from what I understand; so, your option 1 seems to be the best one, I’ll give it a try.

This topic was automatically closed after 250 days. New replies are no longer allowed.