Some users are experiencing issues with the vertical-align: middle
property not working on a span
.
.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-align
CSS 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
span
HTML element is a generic inline container for phrasing content, which does not inherently represent anything.
Therefore, vertical-align
is typically used for inline elements, and since span
is an inline element, why isn't it working?
Vertical align middle not working in span element
One solution could be to use
display: flex
.
Considering that my container already has a flex display, what could be causing the issue?