首页 > 试题广场 >

当使用 `transform: translate(-50%

[单选题]
当使用 `transform: translate(-50%, -50%);` 配合 `position: absolute;` 实现居中时,父元素需要:
  • 设置明确的宽高和 `overflow: visible;`
  • 设置非 static 的定位(如 relative)
  • 避免使用 Flex 或 Grid 布局
  • 添加 `will-change: transform;` 属性

这道题你会答吗?花几分钟告诉大家答案吧!