Maison  >  Article  >  interface Web  >  css background属性_html/css_WEB-ITnose

css background属性_html/css_WEB-ITnose

WBOY
WBOYoriginal
2016-06-24 11:50:531087parcourir

background 简写属性在一个声明中设置所有的背景属性。

所有浏览器都支持 background 属性。

注释:IE8 以及更早的浏览器不支持一个元素多个背景图像。

注释:IE7 以及更早的浏览器不支持 "inherit"。IE8 需要 !DOCTYPE。IE9 支持 "inherit"。

可以设置如下属性:
?background-color
?background-position
?background-size
?background-repeat
?background-origin
?background-clip
?background-attachment
?background-image

如果不设置其中的某个值,也不会出问题,比如 background:#ff0000 url('smiley.gif'); 也是允许的。

通常建议使用这个属性,而不是分别使用单个属性,因为这个属性在较老的浏览器中能够得到更好的支持,而且需要键入的字母也更少。

例子:
body
  {
  background: #00FF00 url(bgimage.gif) no-repeat fixed top;
  }

Déclaration:
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn