bootstrap4怎么快速设置position

 剑鱼论坛 发表于 2020年01月31日 CSS/CSS3  224
剑鱼论坛
LV 8 研究生
最后在线:2年前
加入时间:5年前
主帖:143  跟帖:100

css的position属性是用于元素定位的,我们使用position可以对元素进行绝对定位,相对定位等定位设置。

在bootstrap4里面我们可以不用写css代码方便地实现元素定位,我们来看一下怎么实现的。

先来看下面的代码:

<div class="position-static">...</div>
<div class="position-relative">...</div>
<div class="position-absolute">...</div>
<div class="position-fixed">...</div>
<div class="position-sticky">...</div>

上面代码中的class都有一个统一的形式:“position-”,然后在其后面紧跟着具体的定位描述,从定位描述中我们其实可以很直观地看出来是用于什么定位的,因为其描述跟原生的css代码里面是一样的,只要您熟悉css的话,就很容易明白。

使用bootstrap4的一个好处就是,您可以不用写css代码,这样就可以相对地提高工作效率。

论坛主帖
288
论坛跟帖
316
在线访客
0
今日主帖
0
今日跟帖
0
今日注册
0
92
http://jianyuluntan.com/gentie.html
http://jianyuluntan.com/postzan.html
http://jianyuluntan.com/postcai.html
http://jianyuluntan.com/postshoucang.html
http://jianyuluntan.com/gentiezan.html
http://jianyuluntan.com/gentiecai.html
http://jianyuluntan.com/huifu.html
http://jianyuluntan.com/xiugai.html
http://jianyuluntan.com/shanchugentie.html
1
cmVsZWFzZV8w
0
© 2019 - 2024 剑鱼论坛 版权所有
Powered by JianYuLunTan
剑鱼论坛 976666861
http://jianyuluntan.com/feedback.html
http://jianyuluntan.com/qiandao.html
http://jianyuluntan.com/denglu.html
0
http://jianyuluntan.com/adenglu.html
0
剑鱼论坛