Test1

The div box should resize to the percent of the page given.

by sallyg

HTML

<body>
    <div id = "box">Hi.</div>
</body>

CSS

#box
{
    background:yellow;
}

JavaScript

function resizeToScreen(element, percent)
{
    var wHeight = window.innerHeight;
    var objHeight = wHeight * (percent/100);
    element.style.height = objHeight +"px";
}

window.onresize = resizeToScreen(document.getElementById('box'), 50);