老师提到的面试题

Posted on 2015-04-03 22:26  小蕊同学  阅读(112)  评论(0编辑  收藏  举报

1.html5的文档规范是什么?

<!DOCTYPE html>

2.一个div如何控制位于页面的正中间位置

 1 <!doctype html>
 2 <html>
 3 <head>
 4 <meta charset="utf-8">
 5 <title>div绝对定位</title>
 6     <style>
 7         div{
 8             background:url(images/img2.jpg);
 9             background-position:center;
10             background-repeat:no-repeat;
11             background-size:500px 200px;
12             width:500px;
13             height:200px;
14             margin:0 auto;
15         }
16         .tcenter{
17             margin:0 auto;
18             top:0;
19             }
20         .tright{
21             margin:auto;
22             position:absolute;
23             top:0;
24             right:0
25             }
26         .tleft{
27                 margin:auto;
28                 position:absolute;
29                 top:0;
30                 left:0
31                 }
32         .center{
33             margin:0 auto;
34             position:absolute;
35             top:50%;
36             left:50%;
37             margin-left:-250px;
38             margin-top:-100px;
39         }
40         .bright{
41             margin:0 atuo;
42             position:absolute;
43             right:0;
44             bottom:0;
45         }
46         .bleft{
47             margin:0 auto;
48             position:absolute;
49             bottom:0;
50             }
51         .bcer{
52             margin:0 auto;
53             position:absolute;
54             left:50%;
55             margin-left:-250px;
56             bottom:0;
57             }
58     </style>
59 </head>
60 
61 <body>
62     <div class="tcenter">center</div>
63 </body>
64 </html>

 

Copyright © 2024 小蕊同学
Powered by .NET 9.0 on Kubernetes