CSS background properties
background-color: background color.
background-image: background image address. For example: background-image:url(images/bg.gif)
background-repeat: background tiling mode, value: no-repeat (not tiling ), repeat-x (horizontal direction), repeat-y (vertical direction)
background-position: background positioning. Format: background-position: horizontal positioning, vertical positioning;
Abbreviation
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>php.cn</title> <style type="text/css"> .box1{ background-color:#f0f0f0; width:400px; } .box2{ background-image:url(http://img1.imgtn.bdimg.com/it/u=1182781053,1047826690&fm=21&gp=0.jpg); background-repeat:no-repeat; background-position:center center; width:400px; height:400px; } </style> </head> <body> <div class="box1"> <h1>习近平心中的互联网</h1> <p>互联网是20世纪最伟大的发明,它正在将人类“一网打尽”,人们在不知不觉中已经融入了互联网生态,互联网让世界变成了“鸡犬之声相闻”的地球村。</p> </div> <div class="box2"> </div> </body> </html>