How to set width of a div in percent in JavaScript?

javascript, jquery

Solution

document.getElementById('header').style.width = '50%';

If you are using Firebug or the Chrome/Safari Developer tools, execute the above in the console, and you'll see the Stack Overflow header shrink by 50%.

Problem

Is it possible to set the height/width of an element in percent using JavaScript or jQuery?

Original source

Related problems