Forum Moderators: not2easy

Message Too Old, No Replies

question about backgrounds with css

         

dragon master mokuba

8:40 am on Jul 16, 2008 (gmt 0)

10+ Year Member



whats the difference between this:


background-color:#fff;
background-image: url('lrimages/fade.gif');
background-attachment:fixed;
background-position: left center;

and this:


background:#fff url(lrimages/fade.gif) left bottom;

just wondering. i though it was the same. but they both act differently. the first has the background through all the elements as if it were one element (ending up with different parts of the image on whats supposed to be the same as each other). the second actually uses only one part of the background (like a regular background in a single element should act). the image im using is like 100px tall and 20px wide used for the background in tabs and im trying to use different parts (for mouseover and normal states, etc.) of it instead of breaking it up into separate images.

if my babbling is too hard to understand, its because its almost 4am here and i tend to ramble if i dont get to sleep before then lol

Marcia

8:57 am on Jul 16, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The second is "CSS shorthand." Break it down into its component parts (like how the first is done) and see if it is or isn't the same as the first one.

dragon master mokuba

10:14 am on Jul 16, 2008 (gmt 0)

10+ Year Member



well i tried. but it confuses me. the "left bottom" looks like it should be for the background position (according to the w3 page on it) but is it?

Fotiman

4:15 pm on Jul 16, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



When in doubt, refer to the CSS specs:
[w3.org...]

To answer your question, yes, "left bottom" is referring to the position.

Fotiman

4:18 pm on Jul 16, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



background-color:#fff;
background-image: url('lrimages/fade.gif');
background-attachment:fixed;
background-position: left center;

That, in shorthand, would be:

background: #fff url('lrimages/fade.gif') fixed left center;

Not this, as you had:

background: #fff url(lrimages/fade.gif) left bottom;

dragon master mokuba

5:18 am on Jul 27, 2008 (gmt 0)

10+ Year Member



well then,
what would

background:#fff url(lrimages/fade.gif) left bottom;

be in longhand?

DrDoc

10:19 am on Jul 27, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



background-color: #fff;
background-image: url(lrimages/fade.gif);
background-position: left bottom;