如何对齐背景图像但没有重复或白色边框

时间:2017-05-01 02:59:26

标签: css background background-image

问题是我的客户希望自己作为他网站的背景,当我设计它时,他的脸完全放在徽标旁边。不幸的是,当网站建成时,他的脸被徽标覆盖。 所以我让我的容器具有与设计相同的宽度,但我的客户不支持有空格或重复,他也不想让徽标移动。

我要问的是,我可以增加背景图像的大小,并按照我在Photoshop或某些网站构建器中的方式移动它吗?

谢谢

1 个答案:

答案 0 :(得分:1)

你应该使用像

这样的背景属性
.bgimg{
    background-image: url('mybg.jpg');
    background-repeat: no-repeat; // this will stop repeating your img
    background-position: center center; // your bg img position could be in % too like 50% 50%;
}