Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想知道是否有比使用剪辑路径更简单的方法来限制文本标签的宽度。
这是我正在寻找的有关标签的示例:treemap:
请注意,标签会被包含的图块的边界截断。
该特定示例是使用<div>标签实现的,默认情况下具有此行为。但我使用的是 SVG <rect>,我希望有一种比定义另一个矩形形状的单独剪辑路径更直接的方法。
<div>
<rect>
<rect>您可以将每个元素包装<svg>在相同宽度/高度的元素中。默认情况下,溢出隐藏在内部<svg>元素上。
<svg>