javascript set div width to available width code example
Example 1: javascript set element width
document.getElementById("myElID").style.width = "100px";
Example 2: Write the JavaScript code to set the width of element to 50%;
document.getElementById('header').style.width = '50%';