使用CSS固定背景

来源:岁月联盟 编辑:zhu 时间:2008-08-20
使用CSS固定背景内容简介:使用CSS可以固定背景,格式如下: 标签名{background-attachment:参数} 参数: fixed:页面滚动时,背景固定; scroll:页面滚动时,背景滚动。 实例: html style type=text/css !-- p.1{ background-attachment:fixed; bac 使用CSS可以固定背景,格式如下:
标签名{background-attachment:参数}

参数:
fixed:页面滚动时,背景固定;
scroll:页面滚动时,背景滚动。

实例:

<html>
<style type="text/css">
<!--
p.1{ background-attachment:fixed; background-repeat:no-repeat;background-image:url(mgc.jpg);font-size:100mm}
p.2{ background-attachment:scroll; background-repeat:no-repeat;background-image:url(mgc.jpg);font-size:100mm}
-->
</style>
<head>
<title>CSS</title>
</head>
<body>

<p class="1">fixed</p>
<p class="2">scroll</p>

</body>
</html>

图片内容