首页 > 其他 > 详细

让div垂直水平居中的方法

时间:2015-04-07 23:22:25      阅读:247      评论:0      收藏:0      [点我收藏+]
 1 <!DOCTYPE html>
 2 <html>
 3 <head>
 4 <meta charset="utf-8">
 5 <title>无标题文档</title>
 6 <style>
 7 .myt {
 8     /* background:red url(images/img2.jpg) center center/500px 200px no-repeat;*/
 9      background:red url(images/img2.jpg) center center/500px 200px no-repeat;
10      width:500px;
11      height:200px;
12      margin:0 auto;
13      position:absolute;
14      margin-left:-250px;
15      margin-top:-100px;
16      top:50%;
17      left:50%;
18 }
19 </style>
20 </head>
21 <body>
22 <div class="myt"></div>
23 </body>
24 </html>

 

让div垂直水平居中的方法

原文:http://www.cnblogs.com/lsr111/p/4399710.html

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