Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using CSS Sprites and repeat-x background-position with transparent pixels

I'm asking exactly what the title says...

#submenu-outer{
    height:40px;
    background: #F0EFE2 url(/template/img/main/intro12.png) 0px -240px repeat-x;
    width:100%;
}

That code makes no sense; Any suggestions? I want to repeat the first column of this line. Every other line (of 40px) is null there (0px -240px)

like image 904
Chris P Avatar asked Mar 15 '26 14:03

Chris P


1 Answers

If you use repeat-x as background position it will repeat the whole width of the image file. So if you have transparent pixels in your sprite after 40px, it's actually normal that you get some transparent background every 40px or so.

You could either make your repeating pattern take the whole sprite width, or put it in a seperate file.

like image 77
Leo Avatar answered Mar 17 '26 04:03

Leo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!