Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I make a Bootstrap width responsive

Tags:

bootstrap-4

I have a button which I set it's width to w-25 but as the screen gets smaller I want to remove that 25 I tried w-sm-25 but it did not work is there a way for me to do it.

like image 935
casualhuman Avatar asked Oct 22 '25 10:10

casualhuman


1 Answers

Here are 2 ways...

1 - use the grid (col-sm-3 in 25% width)...

   <div class="row">
        <div class="col-sm-3">
            <button class="btn btn-block btn-primary">Button</button>
        </div>
   </div>

or

2 - add a CSS class and media query...

@media (min-width: 576px) {
    .w-sm-25 {
        width: 25%;
    }
}

Demo: https://codeply.com/p/JAwMbu8O16

like image 61
Zim Avatar answered Oct 27 '25 06:10

Zim