Please Help, this is driving me crazy!
I guess I still don't understand the difference between attributes like:
height
max-height
line-height
or how they affect properties like the vertical alignment of text and images.
What I WANT:
A single line of text, centered vertically with inline images of varying unknown sizes, in a block stuck to the bottom of the screen, basically like this:
The text will always be less than a single "screen width" line, but the images height could vary (larger and/or smaller than text height).
What I HAVE:
- Note that the borders and background are only for demo purposes.
I only need the text & images in a transparent block, stuck to the bottom of the screen.
Below is my code that's producing "what I have" (above). I've experimented with countless frustrating variations and only seem to get farther away from what I want.
How is it possible that so many attributes seem to affect nothing?! (I assume my mistake is something silly and/or obvious!)
.page-container {
position: absolute;
/* does nothing?! */
height: 100%;
}
.txt-img-container {
background-color: lightgreen;
border: dotted 5px green;
width: 100%;
position: sticky;
/* does nothing?! */
bottom: 0px;
/* does nothing?! */
vertical-align: middle;
/* does nothing?! */
min-height: 300px;
/* does nothing?! */
line-height: 300px;
/* does nothing?! */
height: 300px;
/* does nothing?! */
}
.img-container {
border: dashed 5px red;
vertical-align: middle;
/* does nothing?! */
min-height: 300px;
/* does nothing?! */
line-height: 300px;
/* does nothing?! */
height: 300px;
/* does nothing?! */
}
<div class="page-container">
<div class="txt-img-container">
This text && various imgs . . .
<span class="img-container">
<img src="https://placehold.it/50?text=50"/>
</span> . . . should all be centered vertically . . .
<span class="img-container">
<img src="https://placehold.it/100?text=100"/>
</span> . . . within the green 300px div.
</div>
</div>