html - 如何仅使用 HTML/CSS/SVG 使 IE 中的文本大小和行为与其他浏览器相匹配?

标签 html css

我想要一个可以随窗口调整大小的大标题。以下代码在 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 中,文本比其他浏览器小得多。

Opera

IE

如何让 IE 以与其余部分相同的大小显示文本,并且仍然随窗口调整大小?我不介意提供单独的代码,我只是不知道要提供什么服务。

编辑:Kosh Very 的回答解决了尺寸问题。 IE 仍然与其他浏览器不同(见下图),但这应该更容易修复。 enter image description here

最佳答案

更改 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/

相关文章:

mysql - 将 html5 Canvas 作为数据保存到 mysql 数据库

html - W3.CSS 导航选项卡 - 根据 URL 参数选择

css - 带有 iframe 的 Internet Explorer 中滚动条后的垂直空间,如何删除它?

javascript - 使所有盒子的高度相同。使用 Bootstrap 的 Wordpress 网格化后循环,

html - 图像助手不需要的调整大小

html - 使用 html/css 直接链接到 ID 和类

javascript - 将 HTML 文本框预填充的数字更改为小数点后 2 位

javascript - 预加载器 - 此代码是否预加载任何内容?

javascript - 无法添加第二个切换类

css - 使用 CSS 使 div 内容看起来更小