background
英 [?b?kgra?nd]? ?美 [?b?k?ɡra?nd]??
n.(畫等的)背景;底色;背景資料;配樂
復(fù)數(shù): backgrounds
attachment
英 [??t?t?m?nt]? ?美 [??t?t?m?nt]??
n.(用電子郵件發(fā)送的)附件,附屬物;依戀,依附;扣押財(cái)產(chǎn)<法>逮捕,扣押(人,財(cái)產(chǎn))
復(fù)數(shù): attachments
javascript backgroundAttachment 屬性 語法
作用:設(shè)置背景圖像是否固定或者隨著頁面的其余部分滾動。
語法:Object.style.backgroundAttachment=scroll|fixed
注釋:請?jiān)O(shè)置一種可用的背景顏色,這樣的話,假如背景圖像不可用,頁面也可獲得良好的視覺效果。
javascript backgroundAttachment 屬性 示例
<html> <head> <style type="text/css"> body { background-color="#FFCC80"; background-image:url(http://img.php.cn/upload/article/000/005/656/5af270fd37755429.jpg); } p { color:white; } </style> <script type="text/javascript"> function changeAttachment() { document.body.style.backgroundAttachment="fixed"; } </script> </head> <body> <input type="button" onclick="changeAttachment()" value="Set background-image to be fixed" /> <p>This is a paragraph</p> <p>This is a paragraph</p> <p>This is a paragraph</p> <p>This is a paragraph</p> <p>This is a paragraph</p> <p>This is a paragraph</p> <p>This is a paragraph</p> <p>This is a paragraph</p> <p>This is a paragraph</p> <p>This is a paragraph</p> <p>This is a paragraph</p> <p>This is a paragraph</p> <p>This is a paragraph</p> <p>This is a paragraph</p> </body> </html>
運(yùn)行實(shí)例 ?
點(diǎn)擊 "運(yùn)行實(shí)例" 按鈕查看在線實(shí)例