fe6-2:CSS部分
一、元素定位(position):
static、relative、absolute、fixed
其中,static是默认定位;
relative 是相对定位;
absolute 是完全绝对定位,忽略其他所有东西,往上浮动到 非 static 的元素;
fixed 基于 window 的绝对定位, 不随页面滚动改变
//relative
.square {
color: black;
position: relative;
top: -12px;
}
<h1 class="green">E = MC<span class="square">2</span> 质能公式</h1>
//absolute
.close {
position: absolute;
top: 0px;
right: 0px;
}
<button class="close">X</button>
//fixed
.fixed {
background: black;
color: white;
position: fixed;
top: 0px;
left: 0px;
}
<button class="fixed">fixed按钮</button> 相关推荐
CSSEIKOCS 2020-05-19
Phoebe的学习天地 2020-05-09
wangjie 2020-02-26
xiaohuli 2020-02-23
葉無聞 2020-02-03
dazhifu 2020-01-02
impress 2020-01-07
元元 2020-01-02
jiedinghui 2019-12-23
yaodilu 2020-08-03
lanzhusiyu 2020-07-18
lcqin 2020-08-11
小仙儿 2020-06-25
xiaohuli 2020-06-11
CaiKanXP 2020-06-09
songfens 2020-06-08