I have this sprite and i need to repeat-x each color. Is it possible?

alt text

  • what does that mean? can you show an example of what your hoped for end result would be? images as backgrounds repeat or don't repeat, you can't repeat part of a background image, if that's what you're asking Tony Crockford almost 10 years ago

2 answers

danwellman 5600

You should be able to repeat them as you wish if you change the image so that the red stripe appears below the green stripe. Other wise the repeat will show both colours alternating across the width of the image ;)

Just make sure each stripe is the correct height for the element it will be the background image for...

Answered almost 10 years ago by danwellman
Guffa 316

You can't repeat part of an image, so to use repeat-x you have to make the color span the entire width of the image.

You should consider making the image some pixels wider. If it's too narrow the browsers can have problems using it as a background. I've seen that with a 1x1 pixel background image, where it faded out to transparent instead of showing a solid color.

Answered almost 10 years ago by Guffa
  • What's the downvote for? If you don't explain what it is that you don't like, it's rather pointless... Guffa almost 10 years ago