html - Position a div in the center of a page even if the width and height changes -
<div style="height:100px;width:100px;border:1px solid black"></div> how can position div in center?
.parent { position: relative; } .child { width: 300px; height: 100px; padding: 20px; position: absolute; top: 50%; left: 50%; margin: -70px 0 0 -170px; } more find here.
Comments
Post a Comment