Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flip a background image horizontally using css

Tags:

html

css

How can I flip an existing image that I have horizontally for a specific class? I was looking at this thread, How to flip background image using CSS?, but none of the answers worked for me.... Any suggestions on what I can do? Here is the code I have written so far that has not been working:

.cta-dash-green2 > span {

  display: inline-block;
  height: 17px;
  vertical-align: middle;
  width: 17px;
  margin: 0 5px 0 0;
  background: url("../images/icon-cta-dash-green.png");

  -webkit-transform:scaleX(-1);
    -moz-transform:scaleX(-1);
    -ms-transform:scaleX(-1);
    -o-transform:scaleX(-1);
    transform:scaleX(-1);

}
like image 514
user3877471 Avatar asked Jul 25 '14 15:07

user3877471


1 Answers

I use this CSS class in my projects to flip elements:

.flip-it {
    -moz-transform: scaleX(-1);
    -o-transform: scaleX(-1);
    -webkit-transform: scaleX(-1);
    -ms-transform: scaleX(-1);
    transform: scaleX(-1);
    -ms-filter: "FlipH";
    filter: FlipH;
}
like image 81
Idrees Avatar answered Sep 23 '22 17:09

Idrees