LoginSignup
1
1

More than 5 years have passed since last update.

Chromeのsvgの中のtextのフォントのコントロールがきかないです

Posted at

font-family:monospace

white-space:pre
に頑張って欲しいのですが、SafariはできるのにChromeがだめです。

スクリーンショット 2015-06-06 10.50.57.png

<svg viewBox="0 0 400 400" style="width:400px">
    <line x1="0" y1="0" x2="400" y2="0" stroke="black" />
    <line x1="0" y1="0" x2="0" y2="400" stroke="black" />

    <g transform="translate(0, 10)">
        <text x="0" y="10">0123456789</text>
        <text x="0" y="30">abcdefghijklmn</text>
    </g>
    <g transform="translate(0, 60)">
        <text x="0" y="10" style="font-family:monospace;">0123456789</text>
        <text x="0" y="30" style="font-family:monospace;">abcdefghijklmn</text>
    </g>
    <g transform="translate(0,110)">
        <text x="0" y="10" font-family="monospace">0123456789</text>
        <text x="0" y="30" font-family="monospace">abcdefghijklmn</text>
    </g>
    <g transform="translate(0,160)">
        <text x="0" y="10" font-family="monospace" white-space="pre">0123456789x</text>
        <text x="0" y="30" font-family="monospace" white-space="pre">01  45  89x</text>
        <text x="0" y="50" font-family="monospace" white-space="pre">  23  67  x</text>
        <text x="0" y="70" font-family="monospace" white-space="pre">          x</text>
    </g>
    <g transform="translate(0,260)">
        <text x="0" y="10" font-family="monospace" style="white-space:pre;">0123456789x</text>
        <text x="0" y="30" font-family="monospace" style="white-space:pre;">01  45  89x</text>
        <text x="0" y="50" font-family="monospace" style="white-space:pre;">  23  67  x</text>
        <text x="0" y="70" font-family="monospace" style="white-space:pre;">          x</text>
    </g>
</svg>

<svg viewBox="0 0 400 800" style="width:400px">
    <line x1="0" y1="0" x2="400" y2="0" stroke="black" />
    <line x1="0" y1="0" x2="0" y2="400" stroke="black" />
    <style>
      text {
        font-family:monospace;
        white-space:pre;          
      }
    </style>
    <g transform="translate(0,10)">
        <text x="0" y="10">abcdefghijklmn</text>
        <text x="0" y="30">0123456789x</text>
        <text x="0" y="50">01  45  89x</text>
        <text x="0" y="70">  23  67  x</text>
        <text x="0" y="90">          x</text>
    </g>
</svg>


1
1
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1