The CSS background properties define the background effects of an element.
CSS的background属性可为元素定义背景效果。
设置背景颜色 Set the background color
This example demonstrates how to set the background color for an element.
实例:
代码如下 | 复制代码 |
body {background-color: yellow} h1 {background-color: #00ff00} h2 {background-color: transparent} p {background-color: rgb(250,0,255)} |
标题一
标题二
段落
[ 可先修改部分代码 再运行查看效果 ]
设置背景图片 Set an image as the background
This example demonstrates how to set an image as the background
实例:
代码如下 | 复制代码 |
body { background-image:url('attachments/month_0612/52006129151936.jpg') } |
[ 可先修改部分代码 再运行查看效果 ]
重复背景图片 How to repeat a background image
This example demonstrates how to repeat a background image.
实例:
代码如下 | 复制代码 |
body { background-image: url('attachments/month_0612/52006129151936.jpg'); background-repeat: repeat } |
[ 可先修改部分代码 再运行查看效果 ]
背景图片水平重复 How to repeat a background image only horizontally
This example demonstrates how to repeat a background image only horizontally.
实例:
代码如下 | 复制代码 |
body { background-image: url('attachments/month_0612/52006129151936.jpg'); background-repeat: repeat-x } |
[ 可先修改部分代码 再运行查看效果 ]
背景图片垂直重复 How to repeat a background image only vertically
摩尔庄园 安卓官方版v2.9.24091002S
摩尔庄园很多小伙伴一定都在小时候玩过,但随着我们年龄的增长淡
梦幻庄园最新版 官方正版v1.0.0
梦幻庄园是一款非常好玩的模拟经营类游戏,玩家在游戏中有一个属
合并梦幻岛免内购版 v2.1.0
合并梦幻岛无限内购版是游戏的破解版本,在该版本中为玩家解锁了
无悔华夏魅族版 2025最新版v3.5.194
无悔华夏魅族版是一款超级好用的模拟经营游戏。在这里玩家们需要
月影别墅官方安装包2025版 安卓版v2.3.24
月影别墅官方安装包2025版是一款匠心独具的乙女向剧情游戏,