这个CSS代码的解释

时间:2010-05-08 09:35:07

标签: html css

我需要知道这段代码究竟是做什么的..或者如何使用它。实际上我用这个来重复图像作为菜单的背景..需要解释这个..

url("images/home_bg.jpg") repeat-x scroll 0 0 transparent

3 个答案:

答案 0 :(得分:6)

它是background CSS属性的简写表示法。正是由于这个原因,速记是一个坏主意:很难弄清楚它是什么。

长版看起来像这样:

background-image: url("images/home_bg.jpg");
background-repeat: repeat-x;                  /* Repeat image horizontally */
background-attachment: scroll;                /* Whether image is fixed 
                                                 or scrolls with page */
background-position: 0 0;                     /* x position, y position */
background-color: transparent;

Docs on the background properties

答案 1 :(得分:0)

那不是HTML,而是CSS。它是说使用给定的图像作为背景,水平重复但不垂直,从0,0开始,并使其透明(这最后指的是背景颜色,而不是图像)。有关W3C网站上CSS backgrounds的更多信息。

答案 2 :(得分:0)

您可以在http://www.w3schools.com/css/css_background.asp阅读这些属性等内容。