使用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>