I use Bootstrap CSS Buttons Reference.
I create a button: class="btn btn-primary"
.
I want that it background will be black, and the text color will be white. How can I do it?
In Bootstrap, you can control the size as well as the color of your buttons. To change the size of your buttons, you can add the following modifier classes in your HTML: . btn-lg.
Type background-color: in the quotation marks after "style=". This element is used to change the background color of the button. Type a color name or hexadecimal code after "background-color:". You can type name of a color (i.e, blue) or a hexadecimal color.
easy and quick way with
.btn-black{background-color:#000;color: #FFF;}
.btn-black:hover{color: #FFF;}
and
<button type="button" class="btn btn-black" ...
You need to override your css so you can change the background to black. A simple way to do this is to create a custom css class (you can either put this in a <style type="text/css">
tag in your HTML or put this 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" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With