I didn’t put it on an interface to test.
But the logic is that the div
father of all must have margin:auto
, making her stand in the middle of the screen.
Inside is two div's
who are with position:absolute
, to leave in the middle, apply margin:auto
, left:0
and right:0
.
For picture to get in the middle just put one text-align: center
in those div's
.
To make the image responsive, apply width:100%
in them.
Something else in the div
father. She has 800px width
, then the picture will pop. Put a width: 100%
and a max-width: 800px;
to determine the size limit for this div
.
Testing.
<div class="beforeAfterSlidebar">
<div class="bottomImage"><img src="images/afterImage.jpg" width="800" height="600" alt="after" /></div>
<div class="topImage"><img src="images/beforeImage.jpg" width="800" height="600" alt="before" /></div>
</div>
.beforeAfterSlidebar {
position: relative;
width: 100%;
max-width: 800px;
height: 600px;
margin: auto;
}
.beforeAfterSlidebar div {
position: absolute;
top: 0px;
left: 0px;
right: 0;
overflow: hidden;
margin: auto;
text-align: center;
}
.beforeAfterSlidebar div img{
width: 100%;
}
.topImage {
border-right: solid 4px black;
}
You can post your example in the fiddle or here?
– Tafarel Chicotti
put your code to facilitate the response
– Felipe Henrique
Guys, the link with the slide code is in the post, "this slide". I’m using exactly the same images as a test!
– Alberto Freire