将背景图片添加到< div>元件 [英] Adding a background image to a <div> element

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

问题描述

是否可以让一个< div> 元素包含背景图片,如果是的话,我该怎么做?

Is it possible to make a <div> element contain a background image, and if so, how would I go about doing this?

推荐答案

你的意思是这个吗?

You mean this?

<style type="text/css">
.bgimg {
    background-image: url('../images/divbg.png');
}
</style>

...

<div class="bgimg">
    div with background
</div>

这篇关于将背景图片添加到&lt; div&gt;元件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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