I have list with images and text. And I want to see text over image.
Following css will make an element vertically middle aligned:
.parent {
position: relative;
}
.child {
transform: translateY(-50%);
position: absolute;
top: 50%;
}
And following css will make an element both horizontally and vertically middle aligned:
.parent {
position: relative;
}
.child {
transform: translateY(-50%);
position: absolute;
text-align: center;
right: 0;
top: 50%;
left: 0;
}
.list {
overflow: hidden;
list-style: none;
padding: 0;
margin: 0;
}
li{
position: relative;
float:right
}
.textoverlay {
transform: translateY(-50%);
text-align: center;
position: absolute;
z-index: 10;
right: 0;
top: 50%;
left: 0;
}
-