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>
相关推荐
CaiKanXP 2020-06-13
buttonChan 2020-06-06
NARUTOLUOLUO 2011-06-24
dazhifu 2020-01-17
CaiKanXP 2020-01-04
nicepainkiller 2020-07-24
CSSEIKOCS 2020-07-18
冰蝶 2020-07-04
sdbxpjzq 2020-06-25
lanzhusiyu 2020-06-09
opspider 2020-06-06
heavenautumn 2020-05-31
MaureenChen 2020-05-17
zhanghao 2020-05-10
waterv 2020-05-04
xiaohuli 2020-04-22
coulder 2020-04-14
沈宫新 2020-04-10
coulder 2020-04-07