gpt4 book ai didi

javascript - 如何设置
的宽度以适应等宽字体中恒定数量的字母?

转载 作者:技术小花猫 更新时间:2023-10-29 12:29:50 26 4
gpt4 key购买 nike

我研究了一段时间,还没有找到CSS解决方案,emex单位在这种情况下是不正确的。我想要的只是一个完全适合 80x25 等宽文本的 div 框。我必须求助于 Javascript 解决方案吗?

最佳答案

尝试使用描述的 ch 单元 in the CSS3 specification :

Equal to the used advance measure of the "0" (ZERO, U+0030) glyph found in the font used to render it.

因此 width: 80ch 指定了 80 个字符的宽度限制。

关于javascript - 如何设置 <div> 的宽度以适应等宽字体中恒定数量的字母?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1255281/

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