html - child with 100% width in padding applied parent -


i have div css specifications:

width:200px; padding:5px border:1px solid 

and div it's child css:

width:100% border:1px solid 

and these divs has rendered in ff , ie this:
enter image description here

but seems right padding less left one! can 1 tell me why behavior causes?

this happens because borders of inner div not part of definition of width itself, inner div 100% + 2px wide.

you should specify box-sizing: border-box; inner div, width include borders

see mdn documentation further information (and browser support) property.


Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -