Reputation: 339
I've recently started my CSS journey and I'm currently working on my first project for a friend. While testing I noticed my text inside my anchor tag was slightly off center, see comparison below.
The left is on Chrome, the right on IOS
Though it's hard to see, the spacing underneath the text in IOS is bigger than above.
I've tried text-size-adjust: none
and resetting the line-height, but neither seem to work for me.
Any Ideas?
* {
margin: 0;
padding: 0;
font: inherit;
text-size-adjust: none;
}
a {
text-decoration: none;
line-height: 1;
color: black;
display: flex;
align-items: center;
gap: .75rem; /* The gap between the text and the arrow-icon. */
border: 1px solid black;
border-radius: 10rem;
padding: 1rem 1.25rem;
}
<a href="">Read Our Story <span>→</span></a>
Upvotes: 0
Views: 36
Reputation: 178384
I read the following on the net:
Can you try these changes?
* {
margin: 0;
padding: 0;
font: inherit;
text-size-adjust: none;
}
a {
text-decoration: none;
color: black;
display: inline-flex; /* Fix iOS flex alignment */
align-items: center;
gap: .75rem; /* The gap between the text and the arrow-icon. */
border: 1px solid black;
border-radius: 10rem;
padding: 1rem 1.25rem;
line-height: normal; /* Fix text baseline alignment */
vertical-align: middle; /* Centers inside flex */
}
/* Optional iOS fix */
@supports (-webkit-touch-callout: none) {
a {
position: relative;
top: -0.1rem;
}
}
<a href="">Read Our Story <span>→</span></a>
Upvotes: 0