First, I know that the OP has clearly mentioned that he is not looking for any Javascript approach, however I think it might be useful for couple of people who are still open to use Javascript as well.
Here is the answer; To set the size for both width
and height
in the same percentage, you can set the width
of the parent element to width: 100%;
via CSS, then with Javascript you set the height
of the parent to the size of width
. Then you would have a square-shaped element as the parent.
Now you can apply both width: 10%; height: 10%;
to the child elements. Then only things you need to do in order to keep it responsive is to listen for the window
resize event and then you apply the height
again only to the parent, and all children will be updated.
http://jsfiddle.net/sDzHb/
Something like this will keep it responsive to the browser size:
$(window)
.resize(function() {
var w = $(document).width();
$('.parent').height(w);
})
.trigger( 'resize' );