简体   繁体   English

将图像添加到现有的Web模板

[英]Adding Image to existing web template

I'm trying to work out how to add a background image to an existing web template, so the image sits at the bottom of the screen. 我正在尝试找出如何将背景图像添加到现有的Web模板中,以便图像位于屏幕底部。

The template is : http://www.templatescreme.com/free-website-profi-admin and a demo is here : http://www.templatescreme.com/demo/profi-admin/170 模板为: http : //www.templatescreme.com/free-website-profi-admin ,此处为演示: http : //www.templatescreme.com/demo/profi-admin/170

Not sure if I can make this on fiddle, so I've linked to examples of the template. 不知道我能否在小提琴上做这个,所以我已经链接到模板的示例。

The template already has a background image (bg.gif) which is the black and grey banners at the top of the screen. 该模板已经有一个背景图像(bg.gif),它是屏幕顶部的黑色和灰色横幅。 I'd like to keep them, but add another to replace the grey background further down the screen. 我想保留它们,但添加另一个以替换屏幕下方的灰色背景。

Normally I'd just change the css on the body to specify the image: 通常,我只需要更改主体上的css以指定图像即可:

background:url('bg.jpg') 100% 100% no-repeat; background-attachment:fixed; background-position:bottom; background-size:contain;

Obviously doing this will remove the existing image. 显然,这样做会删除现有图像。 Is there any way I can get the two images on the same screen ? 有什么办法可以在同一屏幕上获得两个图像?

Thanks 谢谢

update FIDDLE added 更新FIDDLE已添加

I've added a fiddle that shows the issue..the waves should be at the bottom of the screen and fill the full width. 我添加了一个小提琴来显示问题。波浪应位于屏幕底部并填充整个宽度。

#divid {
    background-image: url(../images/bg.gif), url('../images/bg.jpg');
    background-position: left top, bottom;
    background-repeat: repeat-x, no-repeat;
    background-attachment: initial, fixed;
    background-size: initial, contain;
}

Something like this should work. 这样的事情应该起作用。 Make sure to have values for both images in all properties. 确保所有属性中的两个图像都有值。

I've got this working, by leaving the existing (original) image in place and creating a DIV 100% x 100% and then applying a background image to that. 通过将现有(原​​始)图像保留在原处并创建100%x 100%的DIV,然后对其应用背景图像,我可以完成此工作。

I've used: 我用过:

.test {
    position:fixed;
    padding:0;
    margin:0;
    width: 100%;
    height: 100%;
    background:url('../images/bg.jpg') 100% 100% no-repeat; 
    background-attachment:fixed; 
    background-position:bottom; 
    background-size:contain; }
}

And that seems to have allowed it to work. 这似乎使它能够工作。

Thanks 谢谢

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM