Safari字体渲染似乎与其他浏览器不同

发布于 2025-01-23 12:23:31 字数 973 浏览 4 评论 0 原文

我对以下html-tag有一个问题:

<a href="/partner-team/team" class="button button__style--1">MEHR</a>

CSS看起来像这样:

a {
    text-decoration: none;
}

.button {
    padding: 0.2rem 4rem;
    cursor: pointer;
}

.button__style--1 {
    color: #429a95 !important;
    border: 2px solid #429a95;
    transition: color .3s, background .3s;
    background: white;
    font-weight: 300;
}

在Safari中,我使用Dev工具可以看到以下可见:

”

在chrome中,我可以使用以下方式使用以下方式使用dev工具:

现在,我想知道为什么Safari中的文字在顶部更加顶峰。 是否有任何可能的解决方案可以在所有浏览器(Safari,Chrome,Firefox,Opera和Edge)上获得相同的渲染?

I have an issue with the following HTML-Tag:

<a href="/partner-team/team" class="button button__style--1">MEHR</a>

The CSS looks like this:

a {
    text-decoration: none;
}

.button {
    padding: 0.2rem 4rem;
    cursor: pointer;
}

.button__style--1 {
    color: #429a95 !important;
    border: 2px solid #429a95;
    transition: color .3s, background .3s;
    background: white;
    font-weight: 300;
}

In Safari I get the following visible using Dev Tools:

Button in Safari

In Chrome as example I get the following using Dev Tools:

Button in Chrome

Now I'm wondering why the text in Safari is rendered way more at the top.
Is there any possible solution to get the same rendering on all browsers (Safari, Chrome, Firefox, Opera and Edge)?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

蓝礼 2025-01-30 12:23:31

以下是一个工作片段:

a {
    text-decoration: none;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility; 
}

.button {
    padding: 0.2rem 4rem;
    cursor: pointer;
}

.button__style--1 {
    color: #429a95 !important;
    border: 2px solid #429a95;
    transition: color .3s, background .3s;
    background: white;
    font-weight: 300;
}
<a href="/partner-team/team" class="button button__style--1">MEHR</a>

这里完成的所有工作都是将以下内容添加到您的 a 标签样式:

-webkit-font-smoothing: antialiased;
text-rendering: optimizeLegibility; 

Below is a working snippet:

a {
    text-decoration: none;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility; 
}

.button {
    padding: 0.2rem 4rem;
    cursor: pointer;
}

.button__style--1 {
    color: #429a95 !important;
    border: 2px solid #429a95;
    transition: color .3s, background .3s;
    background: white;
    font-weight: 300;
}
<a href="/partner-team/team" class="button button__style--1">MEHR</a>

All that was done here was adding the following to your a tag styles:

-webkit-font-smoothing: antialiased;
text-rendering: optimizeLegibility; 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文