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

让div垂直水平居中的方法

时间:2015-04-07 23:23:09      阅读:139      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!