博客列表 >固定定位案例

固定定位案例

锋芒天下的博客
锋芒天下的博客原创
2019年07月08日 10:38:16744浏览

<!DOCTYPE html>
<html lang="en">
<head>
   <meta charset="UTF-8">
   <title>固定定位案例</title>

   <style>
       body{
           background: url("static/images/1.png");
           background-repeat: no-repeat;
       }
       #box2 img{
           width: 180px;
           height: 200px;
           position: absolute;
           left: 50%;
           top: 50%;
           margin-left: -90px;
           margin-top: -100px;
       }
       #box1{
           width: 100%;
           height: 1800px;
           background: #000;
           opacity: 0.7;
       }
   </style>

</head>
<body>


   <div id="box1">
       <div id="box2">
           <img src="static/images/2.png" alt="">
       </div>
   </div>

</body>
</html>

声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议