CSS Fill the parent div 100% clean

I want to be able to fill the parent div exactly 100% with a child span. The problem is that I want to fill it with a tag with a themeroller, and it has various indents and fields. Therefore, I cannot hard code any sizes for range height.

If I try to set the range height to 100%, then it really goes over and fills in more than 100% + 6 pixels for this theme (but more depends on the theme). How do you do this, no matter what size fills / fields for the range, will it ever fill 100% of the parent div?

Thank you very much for your help.

+5
source share
2 answers
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;    
box-sizing: border-box;

See http://jsfiddle.net/mbB8t/2/

Refined : works for all modern browsers (IE8 +).

+6
source

To do this, you need to calculate the value of paddings and marginins by adding 2x span width plus height. then you can find out what values ​​to use for span to populate the parent div. check out the examples here http://www.phcityonweb.com/tutorial/css-programming-lessons/margin-padding

+1
source

All Articles