To achieve this effect, you can use a simple method involving 2 elements.
<a href="foo.html" class="button"><span>Button Text</span></a>
In the code above, a span element is nested inside the link to create the button. The background image used for the button should be split into two parts: one for the left side and middle portion, and one for the right side. The span will display the left side of the button image, while the link itself will show the right side. Here's an example of how the CSS might look:
a {
background: url("rightimg.png") right no-repeat;
display: block;
padding-right: [width of image];
width: auto;
height: [height of image];
line-height: [height of image];
}
a span {
background: url("leftimg.png") left no-repeat;
display: block;
width: auto;
height: [height of image];
line-height: [height of image];
}
a:hover {
background: url("rightHover.png") right no-repeat;
}
a span:hover {
background: url("leftHover.png") left no-repeat;
}
You may need to adjust these styles to fit your specific layout requirements.
The reason for placing the left image in the span is to avoid overlapping images if there is transparency in the button design. Make sure to consider this when preparing your images.
It's recommended to make the left image at least 200px wide to allow for potential expansion space.