Can I change the color of the Bootstrap button?

I am using Bootstrap CSS Button Reference .

I create a button: class="btn btn-primary" .

I want its background to be black and the color of the text to be white. How can i do this?

+5
source share
6 answers

You need to override your CSS so that you can change the background to black. An easy way to do this is to create a custom css class (you can put it in the <style type="text/css"> in your HTML or put it in a separate CSS file)

 .black-background {background-color:#000000;} .white {color:#ffffff;} 

Then give your button these classes

 <input type="submit" class="btn btn-primary black-background white" value="Text" /> 
+12
source

This question has already been answered: Styling Twitter boot buttons

I would advise you to follow the advice above; It is common practice to override the default / boostrap style sheet with your own styles, rather than editing the default / bootstrap directly or adding new style classes. The fund works the same way.

+3
source

Yes, you can, try creating a new custom.css file name to add what you need to customize your theme (please enable it after downloading the files).

0
source

Other methods may include:

I can suggest the first if the second seems too complicated, because there are several types of buttons, and you can adjust each color of the bg buttons, as well as other properties. If you want to update your files or configuration, you can download your own configuration to get new files or change your configuration.

And this makes the solution less complicated and more convenient.

0
source

Use (class = "btn btn-primary navbar-inverse") in your button class. No need to write any CSS.

0
source

quick and easy with

  .btn-black{background-color:#000;color: #FFF;} .btn-black:hover{color: #FFF;} 

and

 <button type="button" class="btn btn-black" ... 
0
source

Source: https://habr.com/ru/post/1209979/


All Articles