I'm working on creating a photo album that displays images in full screen and allows users to navigate using arrows.
Check out my progress here:
https://jsfiddle.net/q49wzey6/
Here's the HTML code I'm using:
<div class="main">
<div class="left">
<a href="http://laurent.delrocq.free.fr/test/left.png" style="outline:0">
<img src="http://laurent.delrocq.free.fr/test/left.png" alt="#">
</a>
</div>
<div class="right">
<a href="http://laurent.delrocq.free.fr/test/right.png">
<img src="http://laurent.delrocq.free.fr/test/right.png" alt="#">
</a>
</div>
</div>
And this is the CSS code:
html, body {
height: 100%;
margin: 0;
}
a{
outline:0;
}
.main{
min-height: 100%;
background-image: url(http://laurent.delrocq.free.fr/test/img-1.jpg);
background-size: contain;
background-repeat: no-repeat;
background-position: center center;
}
.left{
position:absolute;
width:20%;
height:100%;
}
.left a, .right a{
position: absolute;
top: 50%;
left:50%;
transform: translate(-50%, -50%);
}
The issue I'm currently facing is that when the browser window is too large, the arrows end up outside of the image. How can I ensure that the arrows stay within the image boundaries while still maintaining the behavior of background-size: contain;
?