小白教程
所有教程
关于
Search
172.69.59.133
172.69.59.133
参数设置
贡献
退出
操作
编辑
移动
保护
信息
历史
删除
查看“Pr background image”的源代码
本页内容
上一节:
Pr_background_attachment
下一节:
Pr_background_repeat
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
{{DISPLAYTITLE:background-image}}[[Category:css reference|42]] = CSS background-image 属性 = 设置body元素的背景图像: <sample title="" desc="" lang="html" hererun="1"> body { background-image:url('paper.gif'); background-color:#cccccc; } </sample> <run name=""> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>小白教程(xiaobai.wang)</title> <style> body { background-image:url('http://static.xiaobai.wang/images/mix/paper.gif'); background-color:#cccccc; } </style> </head> <body> <h1>Hello World!</h1> </body> </html> </run> == 标签定义及使用说明 == background-image 属性设置一个元素的背景图像。 元素的背景是元素的总大小,包括填充和边界(但不包括边距)。 默认情况下,background-image放置在元素的左上角,并重复垂直和水平方向。 提示:请设置一种可用的背景颜色,这样的话,假如背景图像不可用,可以使用背景色带代替。 {| class="table table-striped table-hover" | 默认值: | none |- | 继承: | no |- | 版本: | CSS1 |- | JavaScript 语法: | object object.style.backgroundImage="url(stars.gif)" |} == 浏览器支持 == 表格中的数字表示支持该属性的第一个浏览器版本号。 紧跟在 -webkit-, -ms- 或 -moz- 前的数字为支持该前缀属性的第一个浏览器版本号。 {| class="table table-striped table-hover" ! 属性 ! Chrome ! Internet Explorer / Edge ! Firefox ! Safari ! Opera |- | background-image | 1.0 | 4.0 | 1.0 | 1.0 | 3.5 |} '''注意:''' IE8 及其更早版本不支持一个元素上设置多个背景图片。 == 属性值 == {| class="table table-striped table-hover" ! 值 ! 说明 |- | url('URL') | 图像的URL |- | none | 无图像背景会显示。这是默认 |- | [[func linear gradient|linear-gradient()]] | 创建一个线性渐变的 "图像"(从上到下) |- | [[func radial gradient|radial-gradient()]] | 用径向渐变创建 "图像"。 (center to edges) |- | [[func repeating linear gradient|repeating-linear-gradient()]] | 创建重复的线性渐变 "图像"。 |- | [[func repeating radial gradient|repeating-radial-gradient()]] | 创建重复的径向渐变 "图像" |- | inherit | 指定背景图像应该从父元素继承 |} == 在线实例 == [[try.php?filename=trycss3_background_multiple|多个背景图片]] 本实例演示了文档中多个背景图像。 == 相关文章 == CSS 教程: [[css background|CSS 背景]] CSS3 教程: [[css3 backgrounds|CSS3 背景]]
返回至“
Pr background image
”。
上一节:
Pr_background_attachment
下一节:
Pr_background_repeat