Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css 文本溢出不起作用_Css_Svg - Fatal编程技术网

Css 文本溢出不起作用

Css 文本溢出不起作用,css,svg,Css,Svg,请检查下面的svg代码示例。我在文本元素中使用了文本溢出属性。但是,属性行为无法正常工作 <svg width="180" height="120" viewBox="0 0 180 120"> <style> text { font: 16px sans-serif; } rect { fill: none; stroke: black; vector-effect: non-scaling-stroke; stroke-width: 1; } </sty

请检查下面的svg代码示例。我在文本元素中使用了文本溢出属性。但是,属性行为无法正常工作

<svg width="180" height="120" viewBox="0 0 180 120">
<style>
  text { font: 16px sans-serif; }
  rect { fill: none; stroke: black; vector-effect: non-scaling-stroke; stroke-width: 1; }
</style>

<g>
<rect x="19.5" y="16.5" width="100" height="20"/>
<text x="20" y="2em" width="100">SVG is awesome</text>
</g>

<g transform="translate(0,30)">
<rect x="19.5" y="16.5" width="100" height="20"/>
<text x="20" y="2em" width="100" text-overflow="clip">SVG is awesome</text>
</g>

<g transform="translate(0,60)">
<rect x="19.5" y="16.5" width="100" height="20"/>
<text x="20" y="2em" width="100" text-overflow="ellipsis">SVG is awesome</text>
</g>
</svg>

文本{font:16px无衬线;}
rect{fill:none;笔划:黑色;矢量效果:非缩放笔划;笔划宽度:1;}
SVG太棒了
SVG太棒了
SVG太棒了
SVG文本元素是否支持文本溢出属性?如何在svg元素中使用此属性


谢谢。

文本溢出不是当前SVG 1.1的一部分。标准

一个新的SVG2规范正在进行中,并计划包含在该规范中。UAs开始实现SVG 2,但到目前为止,只有Opera 12实现了文本溢出


同时,您可以通过foreignObject将文本作为html包含,因为html文本支持文本溢出。

。遗憾的是,foreignObject的可能副本在任何版本的ie中都不受支持,因此我不推荐它@好的,那么你的答案是什么?我还不知道,我也在寻找。我只是指出了关于文本溢出的兼容性问题。我有点希望奥弗夫的最后一个解决办法会奏效。但我还没能成功。