Wenn Sie die Größe des Ergebnisbereichs anpassen, um ihn schmaler zu machen, werden Sie sehen, dass der Bildbereich entsprechend angepasst wird.Zentriert div vertikal und horizontal in einem anderen div
Ich hoffe, dass der Text immer vertikal und horizontal zentriert wird, wenn eine solche Größenänderung auftritt.
Ich bin nicht in der Lage, die richtige css dafür zu finden.
.holders {
position: absolute;
bottom: 0;
left: 50%;
margin-left: -150px; /*half of image width*/
}
.holder {
float: left; /*this cannot be changed because we have a row of blocks like the example one in the bottom*/
position: relative;
}
.text {
position: absolute;
top: 150px;
/*this is not right at this moment*/
}
.img {
width: 100%;
height: auto;
}
<div style="position: fixed;top:0;left:0;width:100%;height:100%">
<div class="holders">
<div class="holder">
<div class="text">
This is text that should be in the center of the block vertically and horizontally
</div>
<img class="img" src="http://www.fnordware.com/superpng/pnggrad8rgb.png" />
</div>
</div>
</div>
ist die jsfiddle Beispiel: https://jsfiddle.net/mddc/4tx5h1tq/34/
Vielen Dank für jede Hilfe!
Das überarbeitete jsfiddle funktioniert perfekt! Vielen Dank!!!! – curious1