I'm using modal window with boostrap. I've already changed the background and font color, but I did not succed changing the upper right close button to white.
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true" class="modal_button">×</span><span class="sr-only">Close</span></button>
Here's my css attribute
.modal-header { border-top: 1px solid white; border-left: 1px solid white; border-right: 1px solid white; text-align: left; font-size: 23px; color: white; background-color: #261f31; border-bottom: 0px; }
I would like to turn the X button in white
Bootstrap Button ColorsYou can by using the . btn class in your HTML and the class selector in your CSS.
There are few ways to close modal in Bootstrap: click on a backdrop, close icon, or close button. You can also use JavaScript hide method. Click the button to launch the modal. Then click on the backdrop, close icon or close button to close the modal.
Bootstrap is setting the color like this:
.close { float: right; font-size: 21px; font-weight: 700; line-height: 1; color: #000; text-shadow: 0 1px 0 #fff; filter: alpha(opacity=20); opacity: .2; }
So you can override it with this:
.close { color: #fff; opacity: 1; }
In bootstrap 5 they have a class that allows you to change the color to white for the close button.
<button type="button" class="btn-close btn-close-white" aria-label="Close"></button>
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