用于SVG元素的框模型属性(边距、填充)。他们是支持吗?

时间:2022-06-17 22:26:02

Is it possible somehow to apply html box model properties to basic shape elements in SVG? For example apply margin to <rect> element. I found the explanation that it's not possible:

是否可能以某种方式将html框模型属性应用到SVG中的基本形状元素?例如,将裕度应用于 元素。我找到了不可能的解释:

The display, float and flow properties and all margin, padding, border and background properties can be applied to the top-level svg element but not to child elements within it.

显示、浮动和流属性以及所有的边距、填充、边框和背景属性都可以应用于*svg元素,但不能应用于其中的子元素。

But maybe are there some techniques which make it possible? I'd like to create <rect> element with margins.

但也许有什么技术可以让它成为可能呢?我想要创建具有边距的 元素。

1 个解决方案

#1


6  

There's no flow layout inside an svg, so the concept of a margin will have to be done in absolute terms (read: manually).

在svg中没有流布局,因此必须以绝对的方式(手动)来实现页边距的概念。

Explain your use-case in more detail?

更详细地解释你的用例?

#1


6  

There's no flow layout inside an svg, so the concept of a margin will have to be done in absolute terms (read: manually).

在svg中没有流布局,因此必须以绝对的方式(手动)来实现页边距的概念。

Explain your use-case in more detail?

更详细地解释你的用例?