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*

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*

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