Forum Moderators: not2easy
Using firefox, I was browsing this website that had some nice content boxes, so I wanted to take a look at the background image. In firefox I chose: view background image which shows the image in a new browser window.
The funny thing was the image was all stretched out and distorted.
Does this mean *sometimes* you have to create a skewed image that will somehow look nice when applied in CSS?
if so, this is crazy! hehe
.blah{background:url(http://www.example.com/images/generic.gif) -8px -160px no-repeat;}
And the generic.gif image has many images on it, so the -8px -160px i'm guessing is narrowing down to a single image on the file.
This is on a yahoo site, which I guess is for performance reasons...
I think one of the easiest examples to see it is ask's home page (the search engine), just do a view background image of e.g. their logo.
But as Xapti said, you can only position it, not scale.
Let's say you have divided your background image in 100px by 100px sections and you want to show in a given id the third image on the second row. The logo you want to show can be smaller than the 100px by 100px, just keep it in the upper right corner.
#img1, #logo, #img2 {
background-image: url("http://www.example.com/image.png");
}
#logo {
background-x-position: -300px;
background-y-position: -200px;
width: 50px;
height: 50px;
}
#img1 {
/*other position, other size*/
}
#img2 {
/*other position, other size*/
}
do take a look at ask's homepage, they use it lovely.