svg - SVG 元素的盒模型属性(边距、填充)。他们得到支持吗?

标签 svg margin padding css

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

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.

但也许有一些技术可以让它成为可能?我想创建 <rect>带边距的元素。

最佳答案

svg 中没有流布局,因此边距的概念必须用绝对术语来完成(阅读:手动)。

更详细地解释您的用例?

关于svg - SVG 元素的盒模型属性(边距、填充)。他们得到支持吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12041403/

相关文章:

jquery - 向带有插入标题元素的偶数元素添加边距 0

css - @media 填充不起作用

Python tabstop-aware len() 和填充函数

css - 动画 SVG 填充 CSS ...语法问题?

python - 使用 Python ElementTree 创建没有 ns0 命名空间的 SVG/XML 文档

CSS 链接 :active state and margin moving whole site

html - 为什么这些 inline-block div 元素之间存在无法解释的差距?

android - 默认描边并填充SVG

html - 如何在 html5 中显示 SVG 圆圈内的图像?

c - Padding - 加密算法