There would be some text inside the div and I should be able to set the height and width of div to auto so that it would resize according to text inside. The skew angle would be 45*
Asked
Active
Viewed 582 times
0
-
3Check https://css-tricks.com/examples/ShapesOfCSS/#trapezoid – ketan May 06 '15 at 11:22
-
You need to use :after. Demo: http://jsfiddle.net/Lyqjkkbo/ – QArea May 06 '15 at 12:24
1 Answers
0
try this
CSS
.bar {
height: 100px;
width: 300px;
background: #BC5859;
display:inline-block;
position: relative
}
.bar:before {
display:inline-block;
position: absolute;
content:"";
border-left: 100px solid #BC5859;
border-bottom: 100px solid transparent;
height: 0;
width: 0px;
right: -100px;
top:0;
}

Luís P. A.
- 9,524
- 2
- 23
- 36