Is it possible to give a % height to a div without knowing the height of the parent? or better say, if the height of the parent changes. If this is not possible:
What is the better way to have a text and a background of color and everything flexible to any device? The text should have some distance from the background. Like this case:
Here is the example simplified:http://jsfiddle.net/hQtMU/
HTML:
<div class="grey">
<div class="text">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam magna erat, viverra at elementum at, elementum vitae mauris. Aenean in quam lorem, ut blandit ante. Integer sit amet nisi massa, at adipiscing nunc. Duis in risus a sapien blandit ultrices. Morbi ut ante eu neque porta lacinia et sed nisi. Donec luctus, enim in hendrerit ornare, purus libero adipiscing tortor, eget volutpat nunc tellus vitae turpis. Mauris sed fringilla nibh. Mauris pellentesque mauris eget velit iaculis tincidunt. Suspendisse neque velit, adipiscing nec consectetur sit amet, porttitor sed tortor. Vestibulum interdum auctor lorem, a porta metus eleifend in. Maecenas a lobortis neque. Duis fermentum arcu purus. Praesent eget diam sed felis varius semper ut a tortor. Cras bibendum sollicitudin facilisis. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut auctor adipiscing risus, eget interdum libero ultricies at.
</div><!-- end text -->
</div><!-- end grey -->
CSS:
html, body { height: 100%; width: 100%; margin: 0; }
.grey{
position:relative;
margin:0px auto;
top:0px; left:0px;
width:90%;
height:auto;
min-width:320px;
background:grey;
}
.text {
position:relative;
margin:0px auto;
width:80%;
height:80%; /* this does no work ? */
}