div+css的基础简介及应用(二)——CSS的常用属性
1.CSS常用属性
应用示例如下:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>css常用属性-背景</title>
<style type="text/css">
#bg_CSS01{
border: 2px #00ff00 solid;
background: #ff00ff;
width: 200px;
height: 200px;
}
#bg_CSS02{
border: 2px #00ff00 solid;
background-color: #000000;
width: 200px;
height: 200px;
}
<!-- -->
#bg_CSS03{
border: 2px #00ff00 solid;
background-image: url(images/00.jpg);
width: 512px;
height: 512px;
}
#bg_CSS04{
border: 2px #00ff00 solid;
background-image: url(images/00.jpg);
background-repeat: repeat;/*水平垂直方向都允许平铺*/
/*background-repeat: repeat-x;<!-- 允许水平方向平铺-->*/
/*background-repeat: repeat-y;<!-- 允许垂直方向平铺-->*/
/*background-repeat: no-repeat;<!-- 不允许平铺-->*/
width: 600px;
height: 600px;
}
#bg_CSS05{
border: 2px #00ff00 solid;
background-image: url(images/01.png);
background-repeat: no-repeat;
background-position: center;/*在中心*/
width: 300px;
height: 300px;
}
</style>
</head>
<body>
<div id="bg_CSS01">background设置背景颜色</div>
<div id="bg_CSS02">background-color设置背景颜色</div>
<div id="bg_CSS03">background-image设置背景为图片</div>
<div id="bg_CSS04">background-repeat设置背景图片平铺</div>
<div id="bg_CSS05">background-position设置图片在背景上的位置</div>
</body>
</html> 相关推荐
nicepainkiller 2020-07-24
CSSEIKOCS 2020-07-18
Ladyseven 2020-10-22
李鴻耀 2020-08-17
yaodilu 2020-08-03
qiupu 2020-11-04
jiedinghui 2020-10-25
hellowzm 2020-10-12
zuncle 2020-09-28
Ladyseven 2020-09-11
jiedinghui 2020-09-07
xiaohuli 2020-09-02
葉無聞 2020-09-01
impress 2020-08-26
ThikHome 2020-08-24