Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flip Button Background Image Vertically

I'm using CSS to style my button which has a background Image. I need a press effect. so I tried flopping my button vertically when it is active, as demonstrated in the fiddle.

http://jsfiddle.net/krishnathota/xzBaZ/10/

I'm able to Flip the image but along with the whole button. How can I only flip the background Image. ??

I have to write in another class other than .button:active or what?? Plaease help

Please check the Third and Fourth buttons and flip the BackgroundImage. The Firse and second buttons contain a <img> I do not want it to be flipped.

if this is not cross browser supported, Can you tell me how to change the background when button is active without changing the background color?

like image 365
Krishna Thota Avatar asked Jan 28 '26 11:01

Krishna Thota


1 Answers

Add active state only for image

.button:active img{
    /*Vertical Flip background img*/
    -moz-transform: scaleY(-1);
    -webkit-transform: scaleY(-1);
    -o-transform: scaleY(-1);
    transform: scaleY(-1);
    -ms-filter: flipv; /*IE*/
    filter: flipv; /*IE*/
    top: 1px; position: relative;
    /*-webkit-transform: translateY(1px);-moz-transform: translateY(1px);*/
  } 

DEMO

Here is the best tutorial for flipping the elements separately

http://www.sitepoint.com/css3-transform-background-image/

like image 55
Sowmya Avatar answered Jan 30 '26 12:01

Sowmya



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!