Gaboik1 Gaboik1 - 1 year ago 72
CSS Question

Bootstrap btn-xs does not have the same disabled style as btn

On an application I am building, I needed to disable a button by default.
The button I want to disable by default is the btn-danger

I need the

btn-danger
to be disabled by default and I need it to be a
btn-xs
so it doesn't make the
tr
take too much space. As per the bootstrap documentation, for a button that is not an
<a>
tag, I added the boolean attribute
disabled
to the
button
element but I could not get the desired style.

I then realized that a
btn-xs
does not have the same style when it is disabled as a "normal"
btn
has. here is a JSFiddle illustrating it.

Is this behavior intended and normal? Do I need to write a css button myself? What can I do to solve this? Thanks in advance!

Answer Source

You need to include the btn class as well. So the total class list is btn btn-xs btn-primary.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download