col-xs-4
sets the current element's width
to around 33%
and btn-block
makes the current element's width
100%
.
Within this code, the parent element's width
(div) is 33%
(due to col-xs-4
) while the child element's width is 100%
(because of btn-block
).
<div class="col-xs-4">
<button class="btn btn-block btn-primary">Like</button>
</div>
In the following code snippet, the parent div
's display is set to block
and its width adjusts based on its content. The child element (Button) has both col-xs-4
and btn-block
classes applied, but btn-block
overrides the effect of col-xs-4
by setting a width:100%
.
<div>
<button class="col-xs-4 btn btn-block btn-primary">Like</button>
</div>
If you take out the btn-block
class, you will notice that col-xs-4
works as intended and sets the width to 33%
.
<div>
<button class="col-xs-4 btn btn-primary">Like</button>
</div>
I have created a demonstration for you.