码迷,mamicode.com
首页 > 其他好文 > 详细

position

时间:2018-09-27 01:50:28      阅读:198      评论:0      收藏:0      [点我收藏+]

标签:title   meta   info   style   效果   .com   pos   href   col   

(html内容)

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>position</title>
<link rel="stylesheet" type="text/css" href="0923.css">
</head>
<body>
<div class="box" id="one">One</div>
<div class="box" id="two">Two</div>
<div class="box" id="three">Three</div>
<div class="box" id="four">Four</div>
</body>
</html>

( css内容)

body{
background: purple;
}
.box {
display: inline-block;
width: 100px;
height: 100px;
background: red;
color: black;
}

#one{
position: static;
top: 300px;
left: 300px;
}

#two {
position: absolute;
top: 120px;
left: 110px;
background: blue;
}

#three{
position: fixed;
top: 400px;
right: 150px;
background: yellow;
}

#four{
position: sticky;
top: 500px;
right: 150px;
background: lightblue;
}

 

(各个标签效果图片如下)技术分享图片

position

标签:title   meta   info   style   效果   .com   pos   href   col   

原文地址:https://www.cnblogs.com/2376020104ypj/p/9710687.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!