4

I would like to make a shape where the top is skewY -10deg and the bottom is 10deg to produce the shape as seen in the picture:

div skewed bottom and top

I can't seem to figure out how to accomplish this.

web-tiki
  • 99,765
  • 32
  • 217
  • 249

1 Answers1

1

Working Demo

This should do the trick:

CSS

#test {
    width: 200px;
    height: 200px;
    -webkit-transition: all 300ms ease-in;
     background: black;
    position: relative;
}

#test:after, #test:before {
    display: block;
    content: "";
    color: transparent;
    width: 215px;
    height: 50px;
    background: white;
    position: absolute;
    left: -10px;
    bottom: -20px;
    -webkit-transform: rotate(12deg);
    -moz-transform: rotate(12deg);
}
#test:before {
    bottom: auto;
    top: -20px;
    -webkit-transform: rotate(-12deg);
    -moz-transform: rotate(-12deg);
}

HTML

<div id="test"></div>
Gurpreet Singh
  • 20,907
  • 5
  • 44
  • 60
  • After review it seems that maybe the CSS Perspective + Rotate would work nicely. But I can't seem to get content to not display distorted. http://jsfiddle.net/cyarema/G9bXT/3/ – Christi Yarema May 22 '13 at 23:53
  • @ChristiYarema, do you want this http://jsfiddle.net/G9bXT/4/ ? – Gurpreet Singh May 23 '13 at 16:33
  • Gurpreet....VERY CLOSE. Thanks. Do you think the content could be contained w/within the red box? I tried an overflow hidden...didn't work. These people want images and text to be cut off by the red shape, not just ontop of it. – Christi Yarema May 23 '13 at 17:35
  • Very hard to understand what exactly you want. I might be able to help if you can upload desired result. – Gurpreet Singh May 23 '13 at 18:52
  • [link]http://www.partyplanetxtreme.com/blog/wp-content/uploads/2013/05/ppx.png This is the desired effect i'm trying to achieve without having to use graphics. Thanks for your help. – Christi Yarema May 23 '13 at 20:08
  • Though about this for a while but I can't find any decent CSS solution :(. I think you need to use image here. – Gurpreet Singh May 23 '13 at 23:11
  • Thanks for your help Gurpreet. These designers and their fancy sites...I think they try to give me a headache. – Christi Yarema May 24 '13 at 15:32