如何对齐背景图像但没有重复或白色边框
how to align background image but without repeats or white borders
问题是我的客户想要他自己作为他网站的背景,当我设计它时,他的脸完美地放在了徽标旁边。不幸的是,当网站已经建成时,他的脸被标志遮住了。
所以我让我的容器具有与设计相同的宽度,但我的客户不支持有空格或重复,他也不希望移动徽标。
我想问的是,我可以增加背景图像的大小并像在 Photoshop 或某些网站构建器中那样移动它吗?
谢谢
你应该使用像
这样的背景属性
.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%;
}
问题是我的客户想要他自己作为他网站的背景,当我设计它时,他的脸完美地放在了徽标旁边。不幸的是,当网站已经建成时,他的脸被标志遮住了。 所以我让我的容器具有与设计相同的宽度,但我的客户不支持有空格或重复,他也不希望移动徽标。
我想问的是,我可以增加背景图像的大小并像在 Photoshop 或某些网站构建器中那样移动它吗?
谢谢
你应该使用像
这样的背景属性.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%;
}