I am trying to center an image vertically inside a container div but its not working as expected .
The container div contain also so other images here is my html :
<div id="first-part">
<div id="slider">
<img src="img/1.jpg" class="slider_image" id="1"/>
<img src="img/2.jpg" class="slider_image" id="2"/>
<img src="img/3.jpg" class="slider_image" id="3"/>
<img src="img/next.png" id="next"/>
</div>
</div>
I wan to center the #next div inside the container here is my CSS :
body,#first-part,#slider{
padding:0px;
margin:0px;
}
.slider_image{
width:100%;
position:relative;
}
#slider{
height:660px;
overflow:hidden;
display:inline-block;
white-space:nowrap;
position:relative;
}
#next{
position: relative;
top: 50%;
height: 6em;
margin-top: -3em;
width:80px;
}
I tried changing the Position to absolute fo #next but the images is not even appearing on both cases I tried also with is for #next :
#next{
position:relative;
width:80px;
top:0px;
bottom:0px;
left:2px;
}
I don't won't to change the other css here is a JsFiddle