-1

How to have a crooked div like the red div in this page

Here's my CSS:

#parallelogram {
    width: 150px;
    height: 100px;
    -webkit-transform: skew(20deg);
       -moz-transform: skew(20deg);
         -o-transform: skew(20deg);
    background: red;
}

but it's not correct, i think

Ashraf Bashir
  • 9,686
  • 15
  • 57
  • 82

2 Answers2

2

I guess (and with the poor information provided it's really just a guess) it might not be working because you are only using the vendor-prefixed versions of transform. The browser you're using might be already (and only) supporting the prefix-less form, so you need to add it:

-webkit-transform: skew(20deg);
   -moz-transform: skew(20deg);
     -o-transform: skew(20deg);
        transform: skew(20deg);

Oh, and if you're trying to copy the exact skew of the example you provided, only along the Y axis, use skewY() instead of skew() and 10 degrees instead of 20 degrees:

-webkit-transform: skewY(10deg);
   -moz-transform: skewY(10deg);
     -o-transform: skewY(10deg);
        transform: skewY(10deg);
Constantin Groß
  • 10,719
  • 4
  • 24
  • 50
1

Upon quick inspecting I found that div's transform properties as follows:

transform: skewY(10deg);

Here is a fiddle to get you started

http://jsfiddle.net/98c7e0mq/

JuniorDev
  • 1,170
  • 2
  • 9
  • 19