Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

multiple background CSS3 button (+transparency)

Tags:

css

This is the code I have so far:

background: none;
background-image: url(../images/red-button-bg-left.png), url(../images/red-button-bg-tile.png), url(../images/red-button-bg-right.png);
background-repeat: no-repeat, repeat-x, no-repeat;
background-position: 0 0, 19px 0, 100% 0;

The button looks like:

[left corners image][body image][right corners image]

Normaly my code would work, but, in this case the url(../images/red-button-bg-tile.png) goes beneath left and right images and since it is transparent, messes up the button style.

What's the trick?

like image 400
Gajus Avatar asked Nov 18 '25 23:11

Gajus


1 Answers

Set a transparent left and right border the width of your left & right corner image and use background-clip:padding-box; for the tiled background only. If this sounds unclear, I'd be happy to edit a fiddle you provide.

like image 95
Lea Verou Avatar answered Nov 21 '25 16:11

Lea Verou



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!