Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[css] 第549天 在什么情况下,用translate()而不用绝对定位?反之呢?请说明理由 #3063

Open
haizhilin2013 opened this issue Oct 15, 2020 · 1 comment
Labels
css css

Comments

@haizhilin2013
Copy link
Collaborator

第549天 在什么情况下,用translate()而不用绝对定位?反之呢?请说明理由

3+1官网

我也要出题

@haizhilin2013 haizhilin2013 added the css css label Oct 15, 2020
@qubitsky
Copy link

translate设置百分比值时,百分比是相对元素自身元素尺寸的值
绝对定位的top, left等的百分比值则是相对最近的position为relative\abolute\fixed祖先元素尺寸的值
所以
需要基于元素自身尺寸进行定位时,使用 translate,
需要基于某个祖先元素的尺寸进行定位时,使用 position:abolute

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
css css
Projects
None yet
Development

No branches or pull requests

2 participants