I'm trying to make a image sprite for a box that can stretch vertically and horizontally while also having a hover over state. I usually create a sprite that either stretches vertically or horizontally only. In that case I would make the parts of the box that must stretch infinitely touch either top and bottom of the image to loop vertically or touch the left and right side to stretch horizontally but I'm stuck on making a single sprite for both.
Here is what I am working with that will contain a list (<ul>) of link links that will use the background color from the hover state.
Left side: Regular state. Right side: Hover state
I don't know if I can just use CSS with what I have right now to do what I'm trying to accomplish or if I have to break up the image into little parts for a single file. Here is how I'm imaginging doing it for one side.
Here is what I ended up with in two different files. Still not completely happy because I would like this sprite to be self contained but maybe I'm just being too picky?
Questions:
- Can I achieve my goal with the first image by using CSS code that is supported by most standard browsers meaning not requiring the absolute newest version of Firefox, Chrome, Safari? I want this to be highly compatible.
- If question 1 is No, then how do I create a sprite layout for this example?
- Can you provide example CSS (pseudo code is fine also) if implementation is not obvious for rounded corners?
Note: I know there are now list items in the box right now but imagine a menu and when you hover over the first or last item then the corners along with the header/footer is supposed to turn white to hover over state also. I can probably figure this part out on my own but I just wanted to mention it so that the sprite design isn't lacking this feature.