在演示中'Maintainable CSS' by Natalie Downe ,我看到一条建议说:
"be afraid of heights, vertigo is healthy on the web. NEVER use height in px on anything with text inside"
这是为什么?
最佳答案
我猜这是由于两个原因:
- Web 文档应该是流畅的。如果您的高度固定并且稍后需要添加或删除文本,会发生什么情况?
- 用户可以更改字体大小。关于演示者为何特别挑出像素:
px
中的高度不随字体大小缩放,而至少em
中的高度会缩放。
关于html - 你为什么要 “NEVER use height in px on anything with text inside” ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6277066/