当前第2页 返回上一页
示例:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | <!DOCTYPE html>
<html>
<head>
<meta charset= "UTF-8" >
<style>
div {
width: 400px;
height: 200px;
border: 1px solid red;
}
.demo1{
background-color: paleturquoise;
}
.demo2{
background-image: url(1.jpg);
background-size: 400px;
}
.demo3{
background:paleturquoise url(1.jpg) no-repeat;
background-size: 300px;
}
</style>
</head>
<body>
<div class = "demo1" >纯色背景</div>
<div class = "demo2" >图片背景</div>
<div class = "demo3" >纯色+图片背景</div>
</body>
</html>
|
效果图:

以上就是css如何添加背景的详细内容,更多文章请关注木庄网络博客!
返回前面的内容
相关阅读 >>
css background属性怎么用
css的表格边框使用什么属性设置
css怎么去除滚动条
css中如何让div居中
使用css样式制作单选框
css如何控制网页背景颜色
css怎么把字体颜色改为白色
为什么css的样式不起作用
css font-size属性怎么用
css如何设置垂直居中
更多相关阅读请进入《css》频道 >>
人民邮电出版社
本书对 Vue.js 3 技术细节的分析非常可靠,对于需要深入理解 Vue.js 3 的用户会有很大的帮助。——尤雨溪,Vue.js作者
转载请注明出处:木庄网络博客 » css如何添加背景