中文字幕一区二区人妻电影,亚洲av无码一区二区乱子伦as ,亚洲精品无码永久在线观看,亚洲成aⅴ人片久青草影院按摩,亚洲黑人巨大videos

Style backgroundAttachment 屬性

Style 對象參考手冊 Style 對象

定義和用法

backgroundAttachment 屬性設置或返回背景圖像是否固定或者隨著頁面的其余部分滾動。

語法

設置 backgroundAttachment 屬性:

Object.style.backgroundAttachment="scroll|fixed|local"

返回 backgroundAttachment 屬性:

Object.style.backgroundAttachment
描述
scroll 背景隨著元素一起滾動。這是默認。
fixed 背景保持固定。
local 背景隨著元素的內(nèi)容一起滾動。

瀏覽器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

所有主要瀏覽器都支持 backgroundAttachment 屬性。


實例

實例

設置背景圖像為固定(不滾動):

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>小白教程(json.cn)</title>
<style type="text/css">
body{
????background:#f3f3f3 url('img_tree.png') no-repeat right top;
}
</style>
<script>
function displayResult(){
????document.body.style.backgroundAttachment="fixed";
}
</script>
</head>
<body>

<button type="button" onclick="displayResult()">將背景圖像設置為固定的</button>
<br>
<h1>Hello World!</h1>
<p>這是一個段落</p>
<p>這是一個段落</p>
<p>這是一個段落</p>
<p>這是一個段落</p>
<p>這是一個段落</p>
<p>這是一個段落</p>
<p>這是一個段落</p>
<p>這是一個段落</p>
<p>這是一個段落</p>
<p>這是一個段落</p>
<p>這是一個段落</p>
<p>這是一個段落</p>
<p>這是一個段落</p>
<p>這是一個段落</p>
<p>這是一個段落</p>

</body>
</html>

運行代碼 ?

實例

更多實例

滾動和固定之間切換
滾動和固定的 backgroundAttachment 之間的切換。


Style 對象參考手冊 Style 對象其他擴展