简体   繁体   English

跨度显示内联在 safari 上根本不显示

[英]span display inline not displaying at all on safari

So I'm having a strange issue where all my spans that are display : inline just don't appear on safari even when I use the browser's console and hover the element in the DOM to get the preview of its dimension nothing appears and the box Model shows this所以我有一个奇怪的问题,我的所有display : inline跨度display : inline只是没有出现在 safari 上,即使我使用浏览器的控制台并将元素悬停在 DOM 中以获取其维度的预览没有出现任何内容并且框模型显示这个盒子模型Safari

Whereas firefox or chrome shows the correct dimensions而 firefox 或 chrome 显示正确的尺寸盒子模型火狐

If I change the span display to inline-block everything appears as it should but I canno't use such css rule in this specific case because the word break won't work anymore, I'm using a span for each letter of my banner title to animate it with js + css so I need it to be display : inline Here's the result with display : inline on firefox/chrome如果我将 span 显示更改为inline-block一切都按原样显示,但在这种特定情况下我不能使用这样的 css 规则,因为 word break 不再起作用,我为横幅的每个字母使用了 span使用 js + css 为其设置动画的标题,因此我需要将其display : inline这是display : inline的结果display : inline在 firefox/chrome 上display : inline 显示内联结果

And here with inline-block on firefox/chrome/safari在这里使用 firefox/chrome/safari 上的inline-block 显示内联块结果

So as you can see using inline-block is not an option.因此,正如您所看到的,使用inline-block不是一种选择。

Also I checked my entire website for spans and none of them appear on safari unless I add display : inline-block so it's not specific to my banner title.此外,我检查了我的整个网站的跨度,除非我添加display : inline-block所以它不是特定于我的横幅标题,否则它们都没有出现在 safari 中。 The only common css to all my spans is this one我所有跨度唯一通用的 css 就是这个

    span {
font-weight : 500;
line-height : 3rem;
/* 1rem = 10px in this case */
}

Apart from these two css rules most of them are just plain spans with sometimes font-size or color changes.除了这两个 css 规则之外,它们中的大多数只是简单的跨度,有时会更改font-sizecolor

Edit :编辑 :

To better show what I mean this is what happens when I hover my h1 element using Safari's dev tools为了更好地说明我的意思,当我使用 Safari 的开发工具将 h1 元素悬停时会发生什么Safari 开发工具 h1

And here when I hover any span inside that h1 while it's using display : inline在这里,当我在使用display : inline时将任何跨度悬停在 h1 内时display : inline Safari 开发工具跨内联

And finally when I hover a span inside my h1 while using display : inline-block最后,当我在使用display : inline-block时将一个跨度悬停在我的 h1 内时display : inline-block Safari 开发工具跨越内联块

Edit 2 : After hours of search it seems like the problem comes from the font itself, when I use another one Safari shows my spans elements, still no idea on how to fix that but in case it might point someone in the right direction in the future I'm leaving this note编辑 2 :经过数小时的搜索,问题似乎出自字体本身,当我使用另一个 Safari 显示我的 spans 元素时,仍然不知道如何解决该问题,但以防万一它可能指向正确的方向未来我要留下这张纸条

如果它可以帮助面临同样问题的人,我终于找到了问题,它直接来自字体文件,我再次将它们上传到我的服务器并且它起作用了

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM