<style type="text/css">
div{height:400px}
#container{width:100%}
#left10{width:10%;float:left;background:red}
#rest90{width:90%;float:left;background:yellow}
</style>
<div id="container">
<div id="left10"></div>
<div id="rest90"></div>
</div>
As you can see, I have 2 DIVs on my page, for responsive's sake, I only assign widths to the 2 DIVs in percentage. Now I want the contents in the #rest90 DIV has a 20px distance to its left border. But when I set #rest90's padding-left to 20px, the DIV will be displaced. Fiddle:http://jsfiddle.net/xvnj9oem/
I have always thought padding is inside an element, thus should not affect the element's relative position with other elements. But apparently I was wrong, at least in this case. Is there anything I missed? And do I have to set margin-left for every elements inside #rest90 to achieve my goal?