0

So I have an Image which is of variable height and width inside a div. I have added multiple pictures and hidden all but 1 of them. I have added navigation buttons to display the next image and previous image. These are images themselves, and what I want to do is put them in the middle of the picture just to the left and right of it.

I have gotten them to the left and right of the picture, but cannot seem to get them vertically centered. Is there a good way to do this?

HTML:

<div class="pics">
<div id="prev"></div>
<div id="next"></div>
<img id="pic0" src="fileView.php?id=1" alt="9&quot; x 13&quot; Cake" width="80%" class="curr">
<img id="pic1" src="fileView.php?id=12" alt="9&quot; x 13&quot; Cake" width="80%" class="hide">
<p id="cost" style="float:left;"><b>Price: $15.00</b></p>
</div>

Current CSS:

.pics{
float:left; 
}
#prev, #next{
float:left;
cursor:pointer;
height:30px;
width:30px;
display: table-cell;
vertical-align: middle;
}
#prev{
background:url(fancybox/fancy_nav_left.png) no-repeat center;
}#next{
background:url(fancybox/fancy_nav_right.png) no-repeat center;
margin-left:200px;
}
*[id*='pic']{
margin-left:40px;
margin-right:10px;
}

Current Look: enter image description here

frosty11x
  • 205
  • 1
  • 8

1 Answers1

0

Add this CSS to the Existing.

.pics{
position:relative;
}
#prev, #next{
position:absolute;
margin-top:49%;
}

TESTED HERE

Neil
  • 402
  • 6
  • 18