Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't change bootstrap theme elements color

It's my first time using a bootstrap theme with my ASP.net web application, thus I've been having some difficulties with the CSS editing.

I got this bootstrap template online, and in order to accommodate my needs I want to change the color of the footer div to another color. Here's the code in html

<div class="footer_bottom">
        <div class="copy">
            <p>Copyright &copy; 2014</p>
        </div>
    </div>

and here's the css

.footer_bottom {
padding: 2em 0;
/*background: #7cc4cc;*/
background: #5DBCD2;

}

Basically, I wanna change the color of the div from #7cc4cc to #5DBCD2. When I run my page in google chrome and select the inspect element option the code supposedly works, but in the css properties backgroud: #7cc4cc is slashed out above the line background: #5DBCD2 (which is not slashed out) but the color of the div shown is still #7cc4cc. In short I can't change the CSS color properties of the theme for some reason. Any help would be greatly appreciated.

like image 899
user3763216 Avatar asked Jan 04 '15 09:01

user3763216


People also ask

How do I override Bootstrap CSS variables?

Override Variables Bootstrap has its own “_variables. scss” in the “scss” folder, which contains all variables used in Bootstrap. Now, add the “abstracts” name folder in your scss folder and create “_custom-variables. scss” in that folder.

Does Bootstrap override CSS?

You can override the default styles of Bootstrap elements using two possible methods. The first way — using CSS overrides— applies to sites using BootstrapCDN or the pre-compiled versions of Bootstrap. The second — using Sass variables — applies to sites using the source code version of Bootstrap.

How do I customize Bootstrap components?

There are multiple ways to customize Bootstrap. Your best path can depend on your project, the complexity of your build tools, the version of Bootstrap you're using, browser support, and more. Our two preferred methods are: Using Bootstrap via package manager so you can use and extend our source files.


3 Answers

You could learn a lot by reading about CSS Specificity. CSS is about rules on top of rules, so what I think is happening, is that some rules are getting applied over your:

.footer_bottom { background: #5DBCD2; }

Check for any rules that have higher specificity and make this .footer-bottom declaration higher than that.

The !important solution in the other answers is not something you want to do. Over time these things are going to bite you in your ass, as they blow your specificity through the roof.

like image 83
Sampsa Avatar answered Oct 21 '22 19:10

Sampsa


Use !important to override bootstrap styles:

   .footer_bottom {
      padding: 2em 0 !important;
      background: #5DBCD2 !important;
    }
like image 30
Evgeny Samsonov Avatar answered Oct 21 '22 18:10

Evgeny Samsonov


You are trying to override the bootstrap css so you need to add !important to your background color change like so :

.footer_bottom {
padding: 2em 0 !important;
/*background: #7cc4cc;*/
background: #5DBCD2 !important;
like image 1
ZEE Avatar answered Oct 21 '22 18:10

ZEE