绝对定位
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style>
.father{
/* 相对父亲类进行定位 */
position: relative;
width: 900px;
height: 400px;
background-color: aqua;
}
.son1{
background-color: pink;
/* 相对定位 */
position: absolute;
/* 距离顶部200px */
top: 150px;
/* 距离右边0px */
right: 0px;
/* 设置层级优先级 */
z-index: 1;
}
.son2{
background-color: blue;
/* 相对定位 */
position: absolute;
/* 距离顶部200px */
top: 150px;
/* 距离右边0px */
left: 0px;
}
.son{
width: 100px;
height: 100px;
}
div{
color: red;
text-align: center;
line-height: 100px;
}
</style>
</head>
<body>
<div class="father">
我是father
<div class="son son1">我是son1</div>
<div class="son son2">我是son2</div>
</div>
</body>
</html>
固定定位
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style>
body{
height: 3000px;
background-color: aqua;
}
div{
position: fixed;
bottom: 15px;
right: 10px;
width: 300px;
height: 300px;
background-color: pink;
}
</style>
</head>
<body>
<div>我永远固定在右下角</div>
</body>
</html>
粘性定位
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style>
.pos1{
background-color: aqua;
/* 设置为粘性定位 */
position: sticky;
top: 20px;
}
</style>
</head>
<body>
<p> My teacher, Miss Wang, helped me a lot in
my middle school life. She is a kind easygoing
woman. I must thank her for making a confident
girl. I used to be a shy and unconfident girl.
Mrs. Wang noticed me. She took good care of me and
encouraged me to join the school speech contest.
Of course, I failed. But Mrs. Wang cheered me up a
nd said every man is the architect of his o
wn future. From then on, I practiced every day
. It goes without saying “No pain, no gain.” I w
on the contest in the second term. In my opinion
<p class="pos1">我就是粘性定位</p>
, teachers are the same as gardeners and they volu
nteer today and gain tomorrow. Not only can they
teach knowledge but also they can teach student
s how to be a successful man. Thank you, Mrs
. Wang. You make a duck become a beautiful swa
n. I want to be a teacher that as same as you in
the future.My teacher, Miss Wang, helped me a
lot in my middle school life. She is a kind e
asygoing woman. I must thank her for making a c
onfident girl. I used to be a shy and unconfiden
t girl. Mrs. Wang noticed me. She took good care o
f me and encouraged me to join the school speec
h contest. Of course, I failed. But Mrs. Wang c
heered me up and said every man is the archite
ct of his own future. From then on, I practic
ed every day. It goes without saying “No pain,
no gain.” I won the contest in the second t
erm. In my opinion, teachers are the same as g
ardeners and they volunteer today and gain tom
orrow. Not only can they teach knowledge but
also they can teach students how to be a
successful man. Thank you, Mrs. Wang.
You make a duck become a beautiful swan.
I want to be a teacher that as same as you in
the future.My teacher, Miss Wang, helped me a
lot in my middle school life. She is a kind
easygoing woman. I must thank her for makin
g a confident girl. I used to be a shy and
unconfident girl. Mrs. Wang noticed me. She t
ook good care of me and encouraged me to join t
he school speech contest. Of course, I failed.
But Mrs. Wang cheered me up and said every m
an is the architect of his own future. F
rom then on, I practiced every day. It goes
without saying “No pain, no gain.” I wo
n the contest in the second term. In my opin
ion, teachers are the same as gardeners and th
ey volunteer today and gain tomorrow. Not
only can they teach knowledge bu
t also they can teach students how
to be a successful man. Thank y
ou, Mrs. Wang. You make a duck become
a beautiful swan. I want to be a tea
cher that as same as you in the future
.My teacher, Miss Wang, helped me a lot in m
y middle school life. She is a kind e
asygoing woman. I must thank her for
making a confident girl. I used to
be a shy and unconfident girl. Mrs
. Wang noticed me. She took good care of m
e and encouraged me to join the school speech contest. Of course, I failed. But Mrs. Wang cheered me up and said every man is the architect of his own future. From then on, I practiced every day. It goes without saying “No pain, no gain.” I won the contest in the second term. In my opinion, teachers are the same as gardeners and they volunteer today and gain tomorrow. Not only can they teach knowledge but also they can teach students how to be a successful man. Thank you, Mrs. Wang. You make a duck become a beautiful swan. I want to be a teacher that as same as you in the future.My teacher, Miss Wang, helped me a lot in my middle school life. She is a kind easygoing woman. I must thank her for making a confident girl. I used to be a shy and unconfident girl. Mrs. Wang noticed me. She took good care of me and encouraged me to join the school speech contest. Of course, I failed. But Mrs. Wang cheered me up and said every man is the architect of his own future. From then on, I practiced every day. It goes without saying “No pain, no gain.” I won the contest in the second term. In my opinion, teachers are the same as gardeners and they volunteer today and gain tomorrow. Not only can they teach knowledge but also they can teach students how to be a successful man. Thank you, Mrs. Wang. You make a duck become a beautiful swan. I want to be a teacher that as same as you in the future.My teacher, Miss Wang, helped me a lot in my middle school life. She is a kind easygoing woman. I must thank her for making a confident girl. I used to be a shy and unconfident girl. Mrs. Wang noticed me. She took good care of me and encouraged me to join the school speech contest. Of course, I failed. But Mrs. Wang cheered me up and said every man is the architect of his own future. From then on, I practiced every day. It goes without saying “No pain, no gain.” I won the contest in the second term. In my opinion, teachers are the same as gardeners and they volunteer today and gain tomorrow. Not only can they teach knowledge but also they can teach students how to be a successful man. Thank you, Mrs. Wang. You make a duck become a beautiful swan. I want to be a teacher that as same as you in the future.My teacher, Miss Wang, helped me a lot in my middle school life. She is a kind easygoing woman. I must thank her for making a confident girl. I used to be a shy and unconfident girl. Mrs. Wang noticed me. She took good care of me and encouraged me to join the school speech contest. Of course, I failed. But Mrs. Wang cheered me up and said every man is the architect of his own future. From then on, I practiced every day. It goes without saying “No pain, no gain.” I won the contest in the second term. In my opinion, teachers are the same as gardeners and they volunteer today and gain tomorrow. Not only can they teach knowledge but also they can teach students how to be a successful man. Thank you, Mrs. Wang. You make a duck become a beautiful swan. I want to be a teacher that as same as you in the future. </p>
<p>, teachers are the same as gardeners and they volu
nteer today and gain tomorrow. Not only can they
teach knowledge but also they can teach student
s how to be a successful man. Thank you, Mrs
. Wang. You make a duck become a beautiful swa
n. I want to be a teacher that as same as you in
the future.My teacher, Miss Wang, helped me a
lot in my middle school life. She is a kind e
asygoing woman. I must thank her for making a c
onfident girl. I used to be a shy and unconfiden
t girl. Mrs. Wang noticed me. She took good care o
f me and encouraged me to join the school speec
h contest. Of course, I failed. But Mrs. Wang c
heered me up and said every man is the archite
ct of his own future. From then on, I practic
ed every day. It goes without saying “No pain,
no gain.” I won the contest in the second t
erm. In my opinion, teachers are the same as g
ardeners and they volunteer today and gain tom
orrow. Not only can they teach knowledge but
also they can teach students how to be a
successful man. Thank you, Mrs. Wang.
You make a duck become a beautiful swan.
I want to be a teacher that as same as you in
the future.My teacher, Miss Wang, helped me a
lot in my middle school life. She is a kind
easygoing woman. I must thank her for makin
g a confident girl. I used to be a shy and
unconfident girl. Mrs. Wang noticed me. She t
ook good care of me and encouraged me to join t
he school speech contest. Of course, I failed.
But Mrs. Wang cheered me up and said every m
an is the architect of his own future. F
rom then on, I practiced every day. It goes
without saying “No pain, no gain.” I wo
n the contest in the second term. In my opin
ion, teachers are the same as gardeners and th
ey volunteer today and gain tomorrow. Not
only can they teach knowledge bu
t also they can teach students how
to be a successful man. Thank y
ou, Mrs. Wang. You make a duck become
a beautiful swan. I want to be a tea
cher that as same as you in the future
.My teacher, Miss Wang, helped me a lot in m
y middle school life. She is a kind e
asygoing woman. I must thank her for
making a confident girl. I used to
be a shy and unconfident girl. Mrs
. Wang noticed me. She took good</p>
</body>
</html>