0

Here is a visualization: enter image description here The red needs to always stay in the left corner. The green can grow or shrink, but it has to be always centered. The green and red have to share the same baseline, i.e. regardless of red's height, green stays at the bottom.

I can make them stay on the baseline using align-items, but I can't figure out how to center the green without moving the red. Red can't use position: absolute because then green can't find the baseline.

This is how I currently have it, but this moves red to the center, right next to green. However, if I do justify-content: flex-start, then I can't center green.

container {
    display: flex;
    justify-content: center;
    align-items: baseline;
    position: fixed;
    left: 0;
    right: 0;
}

red {
    max-width: 10%;
}


green {
    display: inline-flex;
}

0 Answers0