【发布时间】:2014-11-14 17:50:47
【问题描述】:
我有以下问题。我认为,有一种快速的方法可以做到这一点,但现在我找不到解决它的方法。
所以,我有一张图片,我希望它在页面顶部的<body> 元素中作为背景图片仅。目前,如果我向下滚动,它正在移动到页面底部。
我有以下代码:
body {
color: #d0d0d0;
font-family: Verdana, Tahoma, sans-serif;
font-size: 12pt;
font-weight: 400;
font-style: normal;
line-height: 1.5;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
margin: 0;
z-index: 0;
background:url(../img/main-bg-top.png) no-repeat top center;
background-attachment: fixed;
background-size: cover;
}
【问题讨论】:
标签: css background background-attachment background-size