我想要一个可以随窗口调整大小的大标题。以下代码在 Windows 10 Chrome、Edge、Firefox 和 Opera(当前版本)中实现了我想要的功能,但在 Internet Explorer 中则不行。
<doctype html>
<html lang="en">
<style>
.bigh {
font-size: 63px;
}
</style>
<body>
<svg viewBox="0 0 500 500">
<path id="headline" fill="transparent" d="M50 50 l 400 0"/>
<!--path id="headline" fill="transparent" d="M80 100 A 180 60, 0, 0, 1, 420 100"/-->
<text width="500" text-anchor="middle" fill="red">
<textPath class="bigh" xlink:href="#headline" startOffset="50%" spacing = "auto">
BIG HEADER
</text>
</svg>
</body>
</html>
在 IE 中,文本比其他浏览器小得多。
如何让 IE 以与其余部分相同的大小显示文本,并且仍然随窗口调整大小?我不介意提供单独的代码,我只是不知道要提供什么服务。
最佳答案
更改 viewBox="0 0 500 110"
会有所帮助:
<doctype html>
<html lang="en">
<style>
.bigh {
font-size: 63px;
}
</style>
<body>
<svg viewBox="0 0 500 110">
<path id="headline" fill="transparent" d="M80 100 A 180 60, 0, 0, 1, 420 100"/>
<text width="500" text-anchor="middle" fill="red">
<textPath class="bigh" xlink:href="#headline" startOffset="50%" spacing = "auto">
BIG HEADER
</text>
</svg>
</body>
</html>
关于html - 如何仅使用 HTML/CSS/SVG 使 IE 中的文本大小和行为与其他浏览器相匹配?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51913469/