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>