首页 > 其他 > 详细

position的 relative+absolute实现固定标签在窗口的某个位置

时间:2018-06-11 12:44:17      阅读:196      评论:0      收藏:0      [点我收藏+]
 1 <!DOCTYPE html>
 2 <html lang="en">
 3 <head>
 4     <meta charset="UTF-8">
 5     <title>Title</title>
 6 </head>
 7 <body>
 8 
 9 <div style="border: 1px solid red;width: 500px;height: 280px;margin: 0 auto;position: relative">
10     <div style="background-color: black;width: 40px;height: 40px;position: absolute;right: 0;bottom: 0;color: white">
11         <div style="line-height: 40px; text-align: center">哈哈</div>
12     </div>
13 
14 
15 </div>
16 <div style="border: 1px solid red;width: 500px;height: 280px;margin: 0 auto;position: relative">
17     <div style="background-color: black;width: 40px;height: 40px;position: absolute;left: 0;top: 0;color: white">
18         <div style="line-height: 40px; text-align: center">哈哈</div>
19     </div>
20 
21 
22 </div>
23 
24 </body>
25 </html>

效果如下图

技术分享图片

 

position的 relative+absolute实现固定标签在窗口的某个位置

原文:https://www.cnblogs.com/topzhao/p/9166476.html

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