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

fix: text-align should only work for text node for flex item #1208

Merged
merged 6 commits into from
Mar 23, 2022

Conversation

temper357
Copy link
Contributor

Close #1205

  • 修复 text-align 在 flex layout 中不应该作用于非文本的 flex item。
  • 对于 W3C 规范来说,text node 的 renderBox 是被包含在一个 anonymous box 中,然后在这个 anonymous box 中被进行对齐,由于 Kraken 并未完整实现 FFC,所以对于文本的对齐需要加额外判断,对于 flex-direction 为 column 且 align-items 为非 stretch 的 case,anonymous box 是与文本同等大小 text-align 也不会 work,因此 text-align 只 work 于 flex-direction: column, align-items: stretch 的 case。

@temper357 temper357 changed the title fix: text-align should only work for text node in flex layout fix: text-align should only work for text node for flex item Mar 10, 2022
@yuanyan yuanyan merged commit f15dd67 into main Mar 23, 2022
@yuanyan yuanyan deleted the fix/text-align-in-flex branch March 23, 2022 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

flex 容器上设置 text-align: center 导致 align-items 失效
3 participants