CSS中背景的综合属性background

来源:互联网 发布:车博士绿色空间 知乎 编辑:程序博客网 时间:2024/05/29 03:16

    背景的综合属性(background)用来同时定义元素背景的各种显示属性,在实际应用CSS的过程中,通常使用背景的综合属性一次性

定义所有的背景属性。

   background: background-image background-repeat  background-position background-color background-attachment

  在背景的综合属性中,所有背景属性值之间使用空格符分隔,当属性值的位置发生变化时,并不影响背景属性的显示效果。

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head>  <title>css实例</title>  <meta name="Generator" content="EditPlus">  <meta name="Author" content="">  <meta name="Keywords" content="">  <meta name="Description" content="">  <style>    background: url(images/round.jpg) repeat-x center #999999;width: 400px;height: 100px;  </style> </head>  <body>   <div>这是背景的综合属性的实例</div>  </body></html>

   注意:在背景综合属性中,可以只定义部分背景属性,其他没有定义的背景属性以默认的方式显示。


原创粉丝点击