在CSS中使用background-attachment属性
的背景依恋t特性用于控制在背景图像的滚动。
示例
您可以尝试运行以下代码,以了解如何使用background-attachment属性:
<!DOCTYPE html>
<html>
<head>
<style>
body {
background-image: url('/css/images/css.jpg');
background-repeat: no-repeat;
background-attachment: fixed;
}
</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 老师节祝福语的简短