CSS中使用哪个属性来控制背景图像的滚动?
要在背景中设置图像的滚动,请使用background-attachment属性。
示例
您可以尝试运行以下代码,以了解如何使用background-attachment属性:
<!DOCTYPE html>
<html>
<head>
<style>
body {
background-image: url('/css/images/css.jpg');
background-repeat: no-repeat;
background-attachment: fixed;
background-attachment:scroll;
}.
</style>
</head>
<body>
<p>The background-image is fixed. Try to scroll down the page.</p>
<p>The background-image is fixed. Try to scroll down the page.</p>
<p>The background-image is fixed. Try to scroll down the page.</p>
<p>The background-image is fixed. Try to scroll down the page.</p>
<p>The background-image is fixed. Try to scroll down the page.</p>
<p>The background-image is fixed. Try to scroll down the page.</p>
<p>The background-image is fixed. Try to scroll down the page.</p>
<p>The background-image is fixed. Try to scroll down the page.</p>
<p>The background-image is fixed. Try to scroll down the page.</p>
</body>
</html>热门推荐
10 打游戏通关祝福语简短
11 高考毕业祝福语简短励志
12 小朋友祝福语简短的话
13 企业励志拜年祝福语简短
14 朋友领证祝福语长文简短
15 双十一祝福语大全简短
16 歌词祝福语高级文案简短
17 中班入学祝福语简短大全
18 收围巾的祝福语简短