Sachindra
Sachindra

Reputation: 6969

Explanation of this CSS code

I need to know what exactly this code does.. or how this can be used..Actually I used this to repeat the image as a background for the menu .. Need explanation for this..

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

Upvotes: 0

Views: 102

Answers (3)

mattruma
mattruma

Reputation: 16677

You can read up on those properties, and more, at http://www.w3schools.com/css/css_background.asp.

Upvotes: 0

T.J. Crowder
T.J. Crowder

Reputation: 1074008

That's not HTML, it's CSS. It's saying to use the given image as the background, repeat it horizontally but not vertically, start at 0,0, and make it transparent (this last refers to the background color, rather than the image). More about CSS backgrounds on the W3C website.

Upvotes: 0

Pekka
Pekka

Reputation: 449385

It's shorthand notation for the background CSS property. Shorthand is a bad idea for exactly this reason: It's hard to figure out what is what.

The long version looks like this:

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

Upvotes: 6

Related Questions