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

Positioning

时间:2018-09-21 23:00:55      阅读:202      评论:0      收藏:0      [点我收藏+]

标签:height   info   utf-8   hit   nbsp   tick   html   one   color   

 
boxPostion.html
<html>
<head>
 <title>Box Position</title>
<meta charset="utf-8">
<link rel="stylesheet" href="boxPosition.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>
 
boxPosition.css
.box {
  display: inline-block;
  width: 100px;
  height: 100px;
  background: red;
  color: white;
}
#two {
  position: relative;
  top: 20px;
  left: 10px;
  background: blue;
}
#three {
 position: absolute;
 top:100px;
 left:100px;
 background: pink;
}
#four {
 position: sticky;
 top:20px;
 left: 200px;
 background: green;
}
 
效果图
技术分享图片

 

 

Positioning

标签:height   info   utf-8   hit   nbsp   tick   html   one   color   

原文地址:https://www.cnblogs.com/BigWatermelon/p/9688643.html

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