General developer forum

Blocks CSS - Any standard classes?

Picture of Neil Haskins
Blocks CSS - Any standard classes?

I'm working on styling a new block. I was hoping to have my button styles follow those of whatever theme is being used, but I can't find if here are any standard element classes in available.

I came across a few pages on related to this, but it looks like the work has been abandoned, but the pages left up.

Is there anything going on in this area? Either way, what are best practices here? My first thought was to use bootstrap styles (class="btn btn-primary"), but I realize not all themes use bootstrap.

Any advise?

Average of ratings: -
Picture of Richard Oelmann
Re: Blocks CSS - Any standard classes?
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developersGroup Testers
Well, you could still use the bootstrap classes and add the relevant bootstrap css to your block /styles style sheet if you think there will be significant use with non-bootstrap themes.
But bootstrap styling is pretty much the accepted way to do things in moodle, the other non-bootstrap themes in the plugins database are essentially legacy ones, although some may still be in use.
The slightly bigger issue is if you use boostrap classes which have changed between BS versions (panels v cards for example)
Average of ratings: -