Bootstrap 4 spacing bug?

前端 未结 1 1727
栀梦
栀梦 2020-12-12 01:54

Bootstrap 4 has Spacing Utilities to adjust margins and paddings with simple CSS classes.

Theoretically, I could do something like this:

<         


        
相关标签:
1条回答
  • 2020-12-12 02:42

    The spacing utils use !important so, using pb-0 to override p-5 isn't going to work because p-5 follows pb-0 in the bootstrap.css

    To get it working like you want set the specific sides...

    <div class="d-inline-block bg-inverse pb-0 px-5 pt-5 mb-0 ml-5 mt-5"></div>

    And, since DIV doesn't have padding or margins by default, you don't really need the *-0...

    <div class="d-inline-block bg-inverse px-5 pt-5 ml-5 mt-5"></div>

    https://www.codeply.com/go/6hSIEizfMd


    Also see, when it's OK to use !important

    0 讨论(0)
提交回复
热议问题