Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding more than margin of 5 in bootstrap

in bootstrap, we can add margin from 0-5 but I want to add more margin using bootstrap , I tried the following m-8 but it's not working

like image 228
Abhishek Mohanty Avatar asked Feb 28 '26 14:02

Abhishek Mohanty


1 Answers

You can add new spacer definitions to the $spacers variable, use your own custom.scss for that, like so:

// 1. import bootstrap's variables to override them
@import "../node_modules/bootstrap/scss/variables";

// 2. your overrides
$spacers: (
  0: 0,
  1: ($spacer * .25),
  2: ($spacer * .5),
  3: $spacer,
  4: ($spacer * 1.5),
  5: ($spacer * 3),
  6: ($spacer * 5)
)

// 3. bootstrap and its default variables
@import "../node_modules/bootstrap/scss/bootstrap";

basically anything you can find in _variables.scss that's relevant for you, you can override.

see this answer for more details: https://stackoverflow.com/a/46125059/3584353

and about overriding bootstrap variables here: https://getbootstrap.com/docs/4.0/getting-started/theming/

like image 108
webpassion101 Avatar answered Mar 05 '26 10:03

webpassion101



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!