how to put a div on the horizental center of a page. this div to display a image. I want to display that image on center, and without fixed size.plus this div should be display on top of other div.
in this case, I want to do it without doing anything about that width of div or image.
I tried some examples, but failed.
what mistake I am doing? I am bit confused. please help
#dart{
position: absolute;
top: 10px;
margin: auto;
z-index: 10000;
margin-left: auto ;
margin-right: auto ;
}
.darts{
height: 80%;
display: block;
margin-left: auto;
margin-right: auto
}
<div id="dart">
<img id="darts" src="../darts.png"/>
</div>