You can draw your shape on canvas (using paper.js or plain JavaScript) then extract it as an image which you set as background to a div or other element.
Just have in mind that you need to update the background if the div's size changes.
var canvas = document.createElement('canvas'),
div = document.getElementById('myDivElement'),
ctx = canvas.getContext('2d'),
cs = getComputedStyle(div),
w = parseInt(cs.getPropertyValue('width') , 10),
h = parseInt(cs.getPropertyValue('height') , 10);
canvas.width = w;
canvas.height = h;
/// draw something on canvas
ctx.lineWidth = 5;
ctx.strokeStyle = '#f90';
ctx.strokeRect(0, 0, w, h);
/// set as background:
div.style.backgroundImage = 'url(' + canvas.toDataURL() + ')';
Just note that many things can affect the div size such as padding, margin, box-sizing, borders etc. These you need to take into account when you are calculating the size of the canvas. The better option is in many cases to use box-sizing: border-box;
for the CSS rule of the element in question.