CSS背景特殊属性值

CSS代码示例-背景附着属性(background-attachment)-[背景图固定不动,不跟随滚动条滚动]:
<html><head>
<title>背景附着属性 background-attachment</title>
<style type="text/css">
body {background-image:url(../images/css_tutorials/background.jpg); background-repeat:no-repeat; background-attachment:fixed} </style>
</head>
<body>
<p>这个HTML使用了CSS的background-attachment属性,将背景图片固定,不随内容滚动而滚动。<p>
<p>背景附着(background-attachment)属性有两个值。一个是scroll,表示随内容滚动而动;一个是fixed,表示固定不动,不受内容滚动影响。缺省值是scroll。</p>
<p>background-attachment要和background-image一起用。</p>
</body></html>

演示结果: 这个HTML使用了CSS的 background-attachment 属性,将背景图片固定,不随内容滚动而滚动

背景附着(background-attachment)属性有两个值。一个是scroll,表示随内容滚动而动;一个是fixed,表示固定不动,不受内容滚动影响。缺省值是scroll。

background-attachment要和background-image一起用。

这个HTML使用了CSS的background-attachment属性,将背景图片固定,不随内容滚动而滚动。

背景附着(background-attachment)属性有两个值。一个是scroll,表示随内容滚动而动;一个是fixed,表示固定不动,不受内容滚动影响。缺省值是scroll。

background-position属性。这个属性和background-image属性连在一起使用,决定了背景图片的最初位置。
<style type="text/css">body{background:#99FF00 url(../images/css_tutorials/background.jpg) no-repeat fixed 40px 100px} </style>

<p>这个属性是设置背景相关属性的一种快捷的综合写法,包括background-color, background-image, background-repeat, backgroundattachment, background-position。</p>
<p>这个HTML所用的背景属性表示,网页的背景颜色是翠绿色,背景是background.jpg图片,图片不重复显示,背景图片不随内容滚动而动,背景图片距离网页最左面40px,距离网页最上面100px。</p>
 
原文地址:https://www.cnblogs.com/loveheyi/p/5319390.html