【发布时间】:2021-08-22 00:23:08
【问题描述】:
编辑:我制作了一个视频来展示这个问题。 在这里找到它:https://streamable.com/r8sl85
我正在我的网站上实施我的 LinkedIn 徽章。他们为我提供了代码。每当我实施它时,徽章确实有效,但不幸的是它破坏了我整个页面的字体。 我制作了一个简化的 html,通过将其与下面其他不相关的代码隔离开来呈现问题。
这两个例子在使用同一个字体css文件时,字体完全不同。
<link rel="stylesheet" type="text/css" href="testStyle.css">
<br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br />
Some Text underneath the Badge <br />
<i>Another line of text</i> <br />
<b>Another line of text</b> <br />
<h1>the last line of text</h1> <br />
对比:
<link rel="stylesheet" type="text/css" href="testStyle.css">
<script src="https://platform.linkedin.com/badges/js/profile.js" async defer type="text/javascript"></script>
<div class="badge-base LI-profile-badge" data-locale="en_US" data-size="large" data-theme="light" data-type="VERTICAL" data-vanity="nick-janse-gis-rastersky" data-version="v1"></div>
Some Text underneath the Badge <br />
<i>Another line of text</i> <br />
<b>Another line of text</b> <br />
<h1>the last line of text</h1> <br />
两者都使用相同的 CSS,如下所示:
html{
font-family:"Calibri";
}
屏幕截图中提供的字体差异: The screenshot
您可以自己在我的实时网站上看到效果,如果您从页面切换,您可以看到加载徽章时“关于我”页面上的字体如何变化。
https://rastersky.com/landing?page=aboutme
我认为过去这一切都很好,但由于某种原因它不再适用了。我怀疑linkedin的javascript与此有关,但仍不确定。
我曾尝试用 css 隔离徽章,但这不起作用:
.LinkedinBadge {
all: unset;
isolation: isolate;
}
谁能找出字体不同的原因以及如何解决这个问题?如果我需要提供更多详细信息,请告诉我。
谢谢。
尼克·詹斯
【问题讨论】:
-
PS:我现在根本看不到我的徽章了。看起来它倒下了(只对我来说?)一旦它恢复,我就会告诉你。也许他们正在修复它。我希望!
-
同样的问题This user 有吗?但那是一个月前的事了。还提到了一种解决方法。
-
看到我不是唯一一个,我有点松了一口气。感谢分享!
-
您解决了吗?我仍然有这个问题。
标签: javascript html css linkedin badge