日期:2014-05-17  浏览次数:20626 次

CSS 背景图片设置
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" > 
 <head><title>Background Image</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <link rel="stylesheet" href="page.css"   media="all"    type="text/css" />
 </head>
 <body>
 <div>this is a test</div>
 </body>
</html>

?

CSS:

div {
?? ?/*
?? ? * (1)图片要用url()给出路径。
?? ? * (2)repeat,not-repeat是2个常用属性
?? ? */
??? background: url("heading2.jpg") repeat;
??? width: 6%;
}

?