[Solved] How to fixed child div position in parent div


width % calculates entire width including border and padding.
so all we need is width = 400 – (20 x 2)(padding) = 360 i.e. 90%.

.parent { border:1px solid black; height:100px; padding:20px; position: relative; width:400px; }
.child { border:1px solid red; height:50px; position:absolute; display:block;width:90%;}

solved How to fixed child div position in parent div