gpt4 book ai didi

css - 您如何在 CSS 中指定字体大小,以便它们匹配模型并允许调整大小?

转载 作者:行者123 更新时间:2023-12-04 16:28:36 25 4
gpt4 key购买 nike

我们在指定字体大小方面遇到了问题。如果我们使用 pt 指定字体大小,它们在浏览器/平台上看起来并不总是相同的。如果我们使用 px 指定字体大小,IE6 用户将无法调整文本大小。

最佳答案

An article on A List Apart (2007 年 11 月)在各种浏览器中对此进行了深入探讨并得出结论:

Sizing text and line-height in ems, with a percentage specified on the body (and an optional caveat for Safari 2), was shown to provide accurate, resizable text across all browsers in common use today. This is a technique you can put in your kit bag and use as a best practice for sizing text in CSS that satisfies both designers and readers.

他们提供了screen shots该技术在大多数流行浏览器中的外观。这是他们使用的代码:

<style type="text/css">`
body {
font-size:100%;
line-height:1.125em;
}

.bodytext p {
font-size:0.875em;
}

.sidenote {
font-size:0.75em;
}
</style>

<!--[if !IE]>-->

<style type="text/css">
body {
font-size:16px;
}
</style>

<!--<[endif]-->

关于css - 您如何在 CSS 中指定字体大小,以便它们匹配模型并允许调整大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/213128/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com