Skip to content

Commit 672fad7

Browse files
committed
update
1 parent 854cecd commit 672fad7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+51
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>css练习之对齐</title>
5+
<meta charset="utf-8">
6+
<style type="text/css">
7+
body{
8+
margin: 0;
9+
padding: 0;
10+
}
11+
.center{
12+
margin: auto;
13+
width: 70%;
14+
background-color: #b0e0e6;
15+
}
16+
17+
.container{
18+
position: relative;
19+
width: 100%;
20+
background-color: #b0e0d4;
21+
}
22+
.right{
23+
position: absolute;
24+
right: 0px;
25+
width: 300px;
26+
background-color: #b0e0e6;
27+
}
28+
.floatright{
29+
float: right;
30+
width: 300px;
31+
background-color: #b0e0e6;
32+
}
33+
</style>
34+
</head>
35+
<body>
36+
<div class="center">
37+
<p>这是一个段落、居中对齐、通过margin:auto实现,并且指定宽度是父容器的百分之七十</p>
38+
<p><b>注释:</b>除非已经声明了 !DOCTYPE,否则使用 margin:auto 在 IE8 以及更早的版本中是无效的。</p>
39+
</div>
40+
41+
42+
<div class="container">
43+
<div class="right">
44+
<p><b>注释:</b>当使用 position 属性进行对齐时,请始终包含 !DOCTYPE 声明!如果省略,则会在 IE 浏览器中产生奇怪的结果。</p>
45+
</div>
46+
</div>
47+
<div class="floatright">
48+
<p>这是一个段落,靠右对齐。是通过flaot:right实现</p>
49+
</div>
50+
</body>
51+
</html>

0 commit comments

Comments
 (0)