0

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*

enter image description here

iitum studant
  • 856
  • 2
  • 8
  • 24

1 Answers1

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;
}

DEMO HERE

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