I have a parent div, and a child div inside of it
CSS
.parent {
background-color: red;
width: 500px;
height: 300px;
margin: 0 auto;
}
.child {
background-color: yellow;
width: 200px;
height: 100px;
}
now I want to set child exactly in middle of parent without changing width and height, how can I do that? thanks.
I figure it out myself, I just needed to position:overflow; parent, then with some margin thing we can center the child in middle.