Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use bootstrap 4 margin and padding properties with pixels?

I would like to use bootstrap 4 margin and padding properties with pixels instead of rems. For example, I would like the following div to have margin-left of 20 pixels:

<div class="container ml-20">Hi</div>

Is it even possible? Thanks in advance.

like image 294
Artem Avatar asked Oct 16 '25 17:10

Artem


1 Answers

Bootstrap doesn't have anything like this. However, you can create a custom css class to handle this for you:

.ml-20 {
    margin-left: 20px;
}

Your options are limitless with how you want to set it up. You could create ml-10, ml-100 or anything you want.

like image 77
CodeLikeBeaker Avatar answered Oct 18 '25 06:10

CodeLikeBeaker



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!