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

下划线厚度是否应当随着字体大小改变而改变? #42

Open
yisibl opened this issue Jan 7, 2014 · 1 comment
Open

下划线厚度是否应当随着字体大小改变而改变? #42

yisibl opened this issue Jan 7, 2014 · 1 comment

Comments

@yisibl
Copy link

yisibl commented Jan 7, 2014

在使用 text-decoration:underline 生成下划线的时候,其厚度是根据字体大小的变化而变化的,但是每个浏览器的计算方式也会有差异。

当父元素设置了 text-decoration:underline ,厚度计算有如下几种情况:

  • IE8-10 中根据字号最大的子元素来计算。
  • Chrome 32 之前根据父元素字号来计算,Chrome 33 开始支持text-underline-position:under,改变了渲染策略,下划线会随着父元素字号改变而改变。
  • Firefox 根据父元素字号来计算。

Chrome 33 现在的实现有很多 Bug,Demo

以上结论需要进一步测试。

通常,text-underline-position:under 是我们需要的中英文混排时的下划线效果,所以在使用 padding-bottom 模拟的时候是否可以尽量往这个效果靠拢?han.css 目前使用的是固定厚度1px

@ethantw
Copy link
Owner

ethantw commented Jan 8, 2014

如果Chrome支援都沒問題了,han.css可以直接採用這個屬性,不支援的瀏覽器則使用當前的邊框fallback。

從範例看起來,底線和字間的距離好像有點大。Chrome是怎麼計算這個間距的呢?

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

No branches or pull requests

2 participants