首页 > Web开发 > 详细

web-position

时间:2018-10-07 19:41:16      阅读:183      评论:0      收藏:0      [点我收藏+]

html:

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8"/>
  <title>四盒子</title>
  <link rel="stylesheet" href=".\作业3.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:

static:

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

#two {
  position: static;
  top: 20px;
  left: 20px;
  background: blue;
}

技术分享图片

relative:

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

#two {
  position: relative;
  top: 20px;
  left: 20px;
  background: blue;
}

技术分享图片

fixed:

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

#two {
  position: fixed;
  top: 20px;
  left: 20px;
  background: blue;
}

技术分享图片

absolute:

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

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

技术分享图片

stickey

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

#two {
  position: sticky;
  top: 20px;
  left: 20px;
  background: blue;
}

技术分享图片

web-position

原文:https://www.cnblogs.com/nsgbdzm/p/9751038.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!