动态地将背景图像添加到div [英] dynamically adding a background image to div

查看:65
本文介绍了动态地将背景图像添加到div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在寻找中心div的背景图片。因为我的div动态获取内容所以它导致n个页面。所以我希望每个页面都有一个背景图像,直到div标签关闭。

i在我的html页面添加div标签



Hi
i'm looking for a background image to my div at center. As my div get the content dynamically so it leads to n number of pages. so i like to have a background image to every page until the div tag get closed.
i add a div tag to my html page

    <div id="abc" style="background-image:url('abc.png');background-repeat:no-repeat;background-removed:50% 30%;">

dynamic content loads here.... 
</div>











i能够获得单页的背景图像,我无法将背景图像提供给剩余的页面。是否有任何jquery代码来获取背景图像o每个页面都在中心。






i am able to get a background image for single page only im unable to get the background image to the remaining pages .is there any jquery code to get background images to every page at centre.

推荐答案

您可以将div图像设置为透明并设置为背景屏幕。



html,正文{

保证金:0;

填充:0;

身高:100%;

宽度:100%;

背景:url( model.png);

背景大小:100%;

}

#全屏

{身高:100%;

宽度:100%;

溢出:auto;

背景:#FF2400;

不透明度:0.2;

}
You can make your div image as transparent and set as your background screen.

html,body {
margin:0;
padding:0;
height:100%;
width:100%;
background: url(model.png);
background-size: 100%;
}
#full-screen
{ height:100%;
width:100%;
overflow:auto;
background:#FF2400;
opacity:0.2;
}


你尝试过类似的东西:



have you tried something like:


' div')。css({' background-image'' url(abc.png)'' background-repeat'' none'});
('div').css({'background-image': 'url(abc.png)', 'background-repeat': 'none'});


这篇关于动态地将背景图像添加到div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆