HTML:
#backgroundproduct {
position: fixed;
top: 5%;
left: 5%;
width: 90%;
height: 90%;
z-index: 12;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
background-position: top;
}
<div id="backgroundproduct" style="background-image: url(http://example.com/example.jpg)">
我使用图像作为背景图像,只有图像的下部比顶部更重要。
如何让背景稍微上扬一点?
最佳答案
如果底部比较重要:background-position: bottom;
background-position
还允许百分比值:0% 0%;
默认情况下。
The first value is the horizontal position and the second value is the vertical. The top left corner is 0% 0%. The right bottom corner is 100% 100%. If you only specify one value, the other value will be 50%.
你应该试试 background-position: 0% -10%;
关于html - CSS 背景大小封面和背景位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13924626/