0

I'm trying to create this using HTML/CSS... http://postimg.org/image/uhmhf04qz/

Now, Initially I tried..

    <div class='box'>
    <p>paragraph here</p>
    </div>

css:

    .box {
    background: red;
    width: 400px;
    height: 800px;
    margin: auto;
    transform: skewX(-20deg);
    }

But that also applies skew to the child paragraph, Which makes it look pretty deformed, I'm trying to make the paragraph fit in the boundaries of the parent div but without being skewed too, Is there a way to do that in HTML/CSS?

Magdi Gamal
  • 681
  • 1
  • 9
  • 25
  • 1
    See this answer I wrote a few days ago - http://stackoverflow.com/questions/19147241/skewed-borders-on-a-div/19147455#19147455 .. It is semi-responsive, and works relevantly well.. – Josh Crozier Oct 04 '13 at 22:18

1 Answers1

0

Compensate with a negative value for the positive value within the p element.

Jsfiddle: http://jsfiddle.net/u4NtT/4/

<div id='shape'>
    <p>paragraph here</p>
</div>

#shape {
    width: 450px;
    height: 350px;
    -webkit-transform: skew(20deg);
    -moz-transform: skew(20deg);
    -o-transform: skew(2d0eg);
    background: #333;
    margin:100px;
}
#shape p {
    font:1em normal Futura, sans-serif;
    color:#f1f1f1;
    padding:60px 60px;
    -webkit-transform: skew(-20deg) !important;
    -moz-transform: skew(-20deg) !important;
    -o-transform: skew(-20deg) !important;
    transform: skew(-20deg) !important;
}
benny
  • 454
  • 2
  • 7
  • 16