Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Override Materialize CSS properties

I have included first Materialize's CSS and then I have linked my css file.

In which I have an example class that sets background-color property to red, but that doesn't override the default color (that's set by materialize-css).

Here's an example: https://jsfiddle.net/79ss2eyr/1/

I'd like not to change anything in materialize's source files, instead I want to add additional classes and set my additional colors.

Here's what the inspector says:

enter image description here

How should I do that and why my css properties do not override materialize's since it's linked after the framework?

like image 583
Ivanka Todorova Avatar asked Apr 22 '16 11:04

Ivanka Todorova


2 Answers

Inn Materialize's the rule is set by footer.page-footer {}, but you're wrote just .app-bg. So you can't override the Materialize's rule.

If u want to override that class you can use footer.app-bg or use !important:

footer.app-bg {
  background-color: red;
}

or

.app-bg {
  background-color: red !important;
}
like image 180
krishna Avatar answered Sep 21 '22 02:09

krishna


Make the css selector more specific, like this:

footer.app-bg {
  background-color: red;
}
like image 42
print x div 0 Avatar answered Sep 17 '22 02:09

print x div 0