Bootstrap: add margin/padding space between columns

前端 未结 14 2236
梦毁少年i
梦毁少年i 2020-12-01 01:45

I\'m trying to put some extra margin/padding space between columns on my Bootstrap grid layout. I\'ve tried this but I don\'t like the result. Here is my code:



        
14条回答
  •  眼角桃花
    2020-12-01 02:30

    You may use the padding and margin shorthand Bootstrap 4 classes as follows:

    For extra small devices i.e. xs

    {property}{sides}-{size}
    

    For other devices/viewports (small, medium, large and extra large)

    {property}{sides}-{breakpoint}-{size}
    

    Where:

    property = m for margin and p for padding
    

    Following are sides shorthand meanings:

    l = defines the left-margin or left-padding
    r = defines the right-margin or right-padding
    t = defines the top-margin or top-padding
    b = defines the bottom-margin or right-padding
    x = For setting left and right padding and margins by the single call
    y = For setting top and bottom margins
    blank = margin and padding for all sides
    

    The breakpoint = sm, md, lg, and xl.

    Combining all the above, the left padding complete code can be (for example):

    For left padding in extra small devices

    pl-2

    or for medium to extra large

    pl-md-2

提交回复
热议问题