这是一个working demo的一个矩形。我想 move the height property to css好吧,它不起作用,让我一片空白。它发生在 firefox 和 chrome 中。
它有不同的名字吗?我不明白为什么我不能使用 css 文件。填充颜色有效。
工作示例。
CSS:
rect {
fill:rgb(0, 0, 255);
/*doesnt work height:100;*/
}
html:
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<rect width="100" height="100" style="stroke-width:1;stroke:rgb(0,0,0)"/>
</svg>
最佳答案
在 SVG 中,<rect>
的 x、y、宽度和高度元素是 attributes而不是 CSS properties .只有 CSS 属性可以使用 CSS 设置样式。
关于css - SVG Rect 忽略高度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14383014/