控制背景图像
如果你想使用背景图像来替代单一的颜色,可以使用background-image指令,这个指令允许你指定背景图像的URL。
Listing B
<html>
<head>
<style type="text/css">
body {
background-image: url('mylogo.gif');
}
</style>
</head>
<body>
</body>
</html>
Figure B就是它运行后的结果:
Figure B

Listing B 示例
你也可以为一个特殊元素指定它的URL,就如Listing C所示:
Listing C
<html>
<head>
<style type="text/css">
.header {
width: 100%;
height: 60%;
border: solid 1px red;
background-image: url('mylogo.gif');
}
</style>
</head>
<body>
<div class="header"></div>
</body>
</html>
运行的结果如Figure C所示:
Figure C

Listing C 示例