Is it possible with either css or js to set the width of an element to match it's height when the height is a % of the parent div. The child div also needs to change size if browser window is resized.
Example
body, html {height: 100%}
.parent {height: 100%; width: 960px;}
.child {
height: 50%;
width: same as height; /* but not 50% of 960px, so that the child div is square*/
}
I'm trying to achieve something like this but width rather than height. Height equal to dynamic width (CSS fluid layout)
Thanks in advance :-)