案例:CSS案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
1
<!DOCTYPE html>
2
<html>
3
<head>
4
<style>
5
body
6
{
7
margin:0;
8
padding:0;
9
}
10
.container
11
{
12
position:relative;
13
width:100%;
14
}
15
.right
16
{
17
position:absolute;
18
right:0px;
19
width:300px;
20
background-color:#b0e0e6;
21
}
22
</style>
23
</head>
24
25
<body>
26
<div class="container">
27
<div class="right">
28
<p><b>注释:</b>当使用 position 属性进行对齐时,请始终包含 !DOCTYPE 声明!如果省略,则会在 IE 浏览器中产生奇怪的结果。</p>
29
</div>
30
</div>
31
32
</body>
33
</html>
34
35
36