problem description
because the horizontal center of flex is used, but the picture in my grandson element cannot be centered horizontally
the environmental background of the problems and what methods you have tried
margin,pannding and so on are mostly wet, why is it strange that there is no effect
related codes
/ / Please paste the code text below (do not replace the code with pictures)
<div class="container">
<div class="wrapper">
<img class="gallery-img" src="http://img1.qunarzz.com/sight/p0/1711/b6/b6dcb80ed40dedbfa3.img.jpg_r_800x800_fcce5c48.jpg" alt="">
</div>
</div>
CSSstylus
<style lang="stylus" scoped>
.container
display: flex
flex-direction: column
justify-content: center
z-index: 99
position: fixed
top: 0
left: 0
right: 0
bottom: 0
background: -sharp212121
.wrapper
overflow: hidden
height: 0
width: 100%
padding-bottom: 100%
background: -sharpfff
//background-position: center
.gallery-img
//background: fixed
width: 100%
//background-position: center
</style>
The position of the red box in the picture should show my picture, but because it is a square picture frame formed by using
height: 0
width: 100%
padding-bottom: 100%
, a series of alignment methods I use do not work. There is a css writing method that works, that is, margin-top:XXX is used in
. Gallery-img, but I want to achieve the dynamic sliding switch effect of many pictures in the book here. There will be differences in height between images, so you can"t use it, margin-top:XXX. What if I want to achieve the middle level of img in wrapper?