html - Firefox 的 SVG 文本路径问题
问题描述
我们的新网站设计中有一个元素,将主题标签放置在通过 svg 的文本路径生成的曲线上。
下面手动编写的开发代码可以在我们的测试浏览器(Firefox、Chrome、Edge)上完美运行。
<div class="hashtags2 xp">
<svg viewbox="0 0 100 25">
<path fill="transparent" id="curve" d="M0 30 V12 Q30 17 55 12 T100 11 V30" />
<text>
<textpath text-anchor="middle" startoffset="50%" xlink:href="#curve">#PedalersKnowsBhutan #BicycleBhutan #ExperienceBhutan #HikeBhutan #DiscoverWithPedalers</textpath>
</text>
</svg>
</div>
但是当我们将设计转换为模板并通过我们的 CMS (MODX) 构建过程运行它时,在 Firefox 中查看时,下面的缩小版本不再显示文本(Chrome 和 Edge 仍然完美显示)。
<div class="hashtags2 xp"><svg viewbox="0 0 100 25"><path fill="transparent" id="curve" d="M0 30 V12 Q30 17 55 12 T100 11 V30" /><text><textpath text-anchor="middle" startoffset="50%" xlink:href="#curve">#PedalersKnowsBhutan #BicycleBhutan #ExperienceBhutan #HikeBhutan #DiscoverWithPedalers</textpath></text></svg></div>
两个版本之间的唯一区别是缺少换行符。
请求的 CSS。
.hashtags2 {
z-index: 15;
font-size: 0.15vw;
position: absolute;
bottom: -34rem;
left: 0;
fill: #fff;
width: 100%;
}
.xp { display: block; }
有没有办法避免 Firefox 的这种怪癖?
开发页面,在 Firefox、Chrome、Edge 和 Opera 中正确显示: https ://pedalers.travel/sandbox/tours-v2018.7.4.4.htm
CMS 构建的页面,在 Chrome、Edge 和 Opera 中正确显示,但在 Firefox 中不正确 https://pedalers.travel/sandbox/test-page.htm
有问题的主题标签位于页脚。
解决方案
推荐阅读
- javascript - 在反应钩子中获取formData中的空值
- java - 使用 2 个道具对对象列表进行排序,即 String 和 Integer,按字母顺序对该列表进行排序,如果 String 相同,则按 DESC Integer 排序
- javascript - 从 html 字符串文本值中查找具有相同类名的跨度值
- angular - 验证和授权所有微软帐户,包括个人帐户和其他租户
- python - 使用装饰器更改参数注释
- sql - Using MODEL clause in Oracle and returning previous values
- kotlin - 使用 Kotlin 泛型和密封接口编译错误
- facebook - Facebook 页面选项卡应用程序“内容被阻止”错误
- c# - 如何在另一个脚本中调用 OnClick 按钮?
- c++ - 有没有人遇到过偶尔的 TSAN 问题?