I add a CSS file (mymovies.css) to a custom form (SeenMovies) in a custom module (eric) with this code I inserted at the end of buildForm
$form['#attached']['library'][] = 'eric/mymovies';
and this code in eric.libraries.yml
mymovies:
version: 1.x
css:
theme:
css/mymovies.css: {}
But my css doesn't override bootstrap.min.css
as you can see in Firefox inspector:
How can I fix that?
<hr>
from a custom module on one form while using Bootstrap at the same time. You could simply fix that by being more specific in your CSS. Like#myform hr { ... }
or even give your<hr>
its own class and then it would behr.my-hr { ... }
. The more precise you are in your selectors the higher is the priority of your styles.<link rel="stylesheet" media="all" href="/themes/contrib/onepage_zymphonies_theme/includes/bootstrap/css/bootstrap.min.css?q9i5qg" />
I assume bootstrap is brought by the theme I use (onepage_zymphonies).#seen-movies hr{...}
works fine!