So I have a section, which is divided into 2 parts. I want the text to be vertically centered and aligned to th left. I managed to vertically center one of my texts, but when I try to add more text, it just moves somewhere else instead of being positioned right on top of the other.
Current result:
HTML:
<section class="outer">
<div class="col2">
<h2>P E R F U M E</h2>
<h1>Gabrielle<br> Essence Eau<br> De Parfum</h1>
<p>A floral, solar and voluptuous<br> interpretation composed by<br> Olivier Polge,
Perfumer-Creator<br> for the House of CHANEL.
</p>
</div>
</section>
CSS:
.col2 {
position: absolute;
display: table;
width: 350px;
height: 600px;
background-color: white;
right: 0;
text-align: left;
}
.col2 h1 {
display: table-cell;
vertical-align: middle;
text-align: left;
padding: 20px;
height: fit-content;
font-family: 'Fraunces';
}
Expected result:
I've tried using display: table
for the container and display: table--cell
for the text itself, which worked just fine with one div but not after adding some new text in another div in addition to te heading.
I also tried something with line-height
but it did something else than expected.