I can’t figure it out how I would make a fully responsive centered text in my image divs.
The last attempt is also in my example fiddle, I tried to position it with absolute and try to change it with @media but that doesn’t work.
http://jsfiddle.net/kb8c1rsv/
Any advice would be helpfull
jenovs
February 26, 2019, 8:02pm
2
.text {
align-items: center;
color: white;
display: flex;
height: 100%;
justify-content: center;
position: absolute;
width: 100%;
left: 0;
top: 0;
z-index: 1;
}
1-1
February 26, 2019, 9:09pm
3
margin-left: auto;
margin-right: auto;
Well your example works for the first picture, when i use it for the next tree images.
It centers it in the middle image.
jenovs
February 27, 2019, 7:23pm
5
Because parent container must have
position: relative
I’m really missing something here I guess, because I doesn’t seem to work on my end.
http://jsfiddle.net/beyondallmeadows/htnxpze4/16/
I also don’t think it’s that complex? I just can’t seem to figure it out.
lasjorg
February 28, 2019, 2:37am
7
You are repeating a lot of CSS that does not need to be repeated. I saved a new version, it has a few comments as well.
http://jsfiddle.net/gf72v9u1/1/
Ok it works, but I am correct that this is not a css-grid move but more a flexbox approach? Whatever works for me is fine, just want to know for the future if this is a better approach to work with images and responsiveness. As I am more used to work with css grid.
Anyways thanks!