You should first use the Less file in Bootstrap instead of bootstrap.min.css and instead of adding the bootstrap in your HTML you import into your .less file with @import '../caminho-do-seu-bootstrap/bootstrap/less/bootstrap.less';
before your settings. This way the code above will work and you do not even need !important
since in the hierarchy your CSS will be over.
Here in Bootstrap documentation you have the variables you can customize. With this you customize and use the variables in your own file, after doing @import
. For example, in your Less would look something like this:
@import '../bootstrap/less/bootstrap.less';
@media (max-width: @screen-xs-max) {
#test{
background-color: #285e8e;
}
}
Just as a remark, it's important to never change third-party codes as it can bring you many future problems. In the case of CSS, even if you do not know how, assume that you can always overwrite the third-party code instead of modifying them, and then you try to figure out how to do it. Most of the time, just insert your CSS later and use the same classes / variables to override the properties.