设为首页
 加入收藏
 联系站长
站内搜索:   您的位置:PHP自学网>> 首页 >> Css >> 使用CSS固定背景

使用CSS固定背景

日期:2008-08-23     来自:互联网    浏览:1775

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

  TAGs: css   背景  
文章评论:(查看全部评论)
昵   称: 匿名 关闭留言
还可以输入250个字 (请自觉遵守互联网相关政策法规)

验证码: 点击图片刷新验证码
相关文章
热门文章
随机文章