div 怎样插入背景图片

如题所述

四种方法:

需要注意的是,如果div中没有内容,则通过设置高宽来设置测试查看背景图片

第一种:

<div style="background:url(images/2.jpg); height:200; width:200;"></div>

第二种:

head部分引入

<style>.div{background:url(images/2.jpg); height:200; width:200;}</style>

第三种:在head部分引入外部样式表

<link rel="stylesheet" type="text/css" href="css/style.css"/>

并在style表中写入:

.div{background:url(images/2.jpg); height:200; width:200;

第四种,在设计页面直接选择:修改>页面属性>背景图像

希望能够帮助到你,满意请选择。谢谢。

温馨提示:答案为网友推荐,仅供参考
第1个回答  2014-10-26
修改——页面属性——背景图像
相似回答