CSS背景大小的封面和背景位置

CSS背景大小的封面和背景位置

本文介绍了CSS背景大小的封面和背景位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HTML:

     > 

$ code>默认情况下。

您应该尝试 background-position :0%-10%;


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)">

I'm using a images as a background image, only the lower part of the image is more important than the top.

How can I make the background go up a little?

解决方案

If the bottom is more important: background-position: bottom;

background-position also allows percentage values: 0% 0%; by default.

You should try background-position: 0% -10%;

这篇关于CSS背景大小的封面和背景位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-31 04:32