内嵌偏移 (Inset)

相对于元素的边缘对元素进行定位。

inset 属性(历史上称为 toprightbottomleft)定义了定位元素的偏移量。其行为取决于 position 属性。

属性

inset 是 Taffy(以及 CSS 简写)中的辅助属性,用于设置:

属性描述
top距离顶部的距离。
bottom距离底部的距离。
left距离左侧的距离。
right距离右侧的距离。

行为

  • 对于 Position.Absolute:偏移量相对于最近的已定位祖先
  • 对于 Position.Relative:偏移量相对于元素在流中的正常位置

示例

Loading Preview…

后续步骤

© 2026 ByteLand Technology Limited