For some a reason vertical-align: middle on a span doesnt work.
.tc__timezone-toggle {
display: flex;
}
.tc__timezone-toggle span {
vertical-align: middle;
}
.tc__timezone-toggle-ui {
display: block;
font-weight: 700;
color: var(--tc-blue) !important;
background-color: #E3E3E3;
padding: 10px;
}
a.tc__timezone-toggle-ui {
border-radius: 22px 0px 0px 22px;
}
.tc__timezone-toggle-ui:last-child {
border-radius: 0px 22px 22px 0px;
}
<div class="tc__timezone-toggle">
<span>TimeZone</span>
<a class="tc__timezone-toggle-ui" href="#">PT</a>
<a class="tc__timezone-toggle-ui" href="#">ET</a>
</div>
https://developer.mozilla.org/en-US/docs/Web/CSS/vertical-align
The
vertical-alignCSS property sets vertical alignment of an inline, inline-block or table-cell box.
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/span
The
spanHTML element is a generic inline container for phrasing content, which does not inherently represent anything.
So vertical-align is for inline elements. span is inline.
Why doesn't it work?
Vertical align middle not working in span element
You can use
display: flexto achieve this.
My container is flex.
What's wrong?