I have a situation where I think that using the "em" metric would be ideal. I have a container with several elements inside. These elements all use em for sizes, font size, borders .. that's it. I want to be able to grow or shrink all of these elements dynamically by simply changing the em value of the parent container.
At least my theory. I tried to implement something like this using jquery, but it seems that everything is converted to px and changing em does not affect the children.
Here is an example:
<div id="parent">
<div class="child">Text</div>
<div class="child">Text</div>
<div class="child">Text</div>
</div>
<style>
#parent { font-size: 1em; }
.child { width: 10em; height: 10em; font-size: 5em; }
</style>
With javascript (jquery for this example), I would like to do something like this:
$('#parent').css('font-size', '2em')
$('#parent').css('font-size', '.5em')
. , , , px. , . :
firebug
$('#parent').css('font-size');
$('.child:first').css('font-size');
$('#parent').css('font-size', '2em');
$('#parent').css('font-size');
$('.child:first').css('font-size');
, 50 .
? ? , ? , , .
.