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

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

时间:2018-06-11 13:49:29      阅读:374      评论:0      收藏:0      [点我收藏+]

标签:技术分享   AC   doctype   png   src   lin   ima   white   absolute   

 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实现固定标签在窗口的某个位置

标签:技术分享   AC   doctype   png   src   lin   ima   white   absolute   

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

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