Here are two possible solutions:
Using Background-size
One simple option would be to have a background image with the shape that you want that fits the whole size of the div
and that adapts to its size changes. Something like this:
.mydiv {
width:100%;
background:url(https://i.stack.imgur.com/Kbmfx.png);
background-size:100% 100%;
padding-bottom:30px;
}
<div class="mydiv">
<p>Line 1</p>
<p>Line 2</p>
<p>Line 3</p>
</div>
If instead of using a bitmap/raster image (like PNG/JPEG), you use a vector image (like SVG), then you would avoid the distortion/blurriness/pixelization that can be seen when scaling. And SVG is supported by all major browsers (including IE9+, but not older versions of IE)... but anyway, this solution uses background-size
that is not supported until IE9+. So if this solution works, SVG should work with it.
Using an absolute-positioned image
If you still want to support IE8 and below, here is another possible solution: add a position:relative
to .mydiv
, then place an image with position:absolute
occupying the whole width/height of .mydiv
in the back of it (using a negative z-index).
The effect would be similar to having that image as background with a size of "100% 100%" and it's CSS2, so supported by older versions of IE. Again, using SVG will avoid having blurry edges (but wouldn't work on IE<8).
Here is a demo:
.mydiv {
position:relative;
width:100%;
padding-bottom:30px;
}
.mydiv .bg {
position:absolute;
top:0;
left:0;
width:100%;
height:100%;
z-index:-1;
}
<div class="mydiv">
<img src="https://i.stack.imgur.com/Kbmfx.png" alt="" class="bg" />
<p>Line 0</p>
<p>Line 1</p>
<p>Line 2</p>
<p>Line 3</p>
<p>Line 4</p>
<p>Line 5</p>
</div>
One good thing about these solutions is that they are really simple to implement... But on the bad side, the shadow may still look a bit funky, and if you use SVG (I would) it is not supported in older versions of IE (although you could have a fallback solution for those browsers using PNG).
Finally, this is a demo solution using SVG inline, as the shadow effect (that I got from Erik Dahlström's answer) would be cut otherwise.
.mydiv {
position:relative;
width:100%;
padding-bottom:30px;
}
.mydiv svg {
position:absolute;
top:0;
left:0;
width:100%;
height:100%;
overflow:visible;
z-index:-1;
}
<div class="mydiv">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" preserveAspectRatio="none" viewBox="0 0 1000 1000" width="100%" height="100%">
<filter id="dropshadow" height="130%">
<feGaussianBlur in="SourceAlpha" stdDeviation="10"/>
<feOffset dx="0" dy="0" result="offsetblur"/>
<feMerge>
<feMergeNode/>
<feMergeNode in="SourceGraphic"/>
</feMerge>
</filter>
<path d="M0,0 1000,0 1000,900 0,1000Z" fill="red" style="filter:url(#dropshadow)" />
</svg>
<p>Line 0</p>
<p>Line 1</p>
<p>Line 2</p>
<p>Line 3</p>
<p>Line 4</p>
<p>Line 5</p>
</div>