Bootstrap padding&margin样式

本文详细介绍了Bootstrap中用于设置元素margin和padding样式的类名规则,包括-m和-p前缀,以及-t、-b、-s、-e、-x、-y和-NULL等不同边的设定,以及对应的尺寸值。这些类帮助开发者快速调整元素的内外边距,实现布局的精细化控制。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

        Bootstrap中使用以下样式的类名,指定元素的padding和margin样式:

{property}{sides}-{size}

        其中 property的值为:

        - m:用于设置margin样式;

        - p :用于设置padding样式;


        其中sides值指定样式适用的边,可选值为:

        - t :设置margin-top或padding-top;

        - b :设置margin-bottom或padding-bottom;

        -s  :根据body的direction属性来设置

                        默认或direction='ltr':margin-left或padding-right;

                        direction='rtl':margin-right或padding-left;

        -e :与-s相反;

        -x :同时设置margin-left/margin-right或padding-left/padding-right;

        -y :同时设置margin-top/margin-bottom或padding-top/padding-bottom;

        -NULL :如果sides值为空,表示四条边都会被设置;


        其中size值指定样式的值,可选值为:

        0 :指定的margin或padding都设置为0;

        1 :指定的margin或padding都设置为$spacer*0.25;

        2 :指定的margin或padding都设置为$spacer*0.5;

        3 :指定的margin或padding都设置为$spacer;

        4 :指定的margin或padding都设置为$spacer*1.5;

        5 :指定的margin或padding都设置为$spacer*3;

        auto :只能用于设置margin,将其值设置为auto;

        ($spacer默认为一个rem)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值