有多少px占据单一? [英] How many px occupy the single  ?

查看:116
本文介绍了有多少px占据单一?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是想知道有多少px占据单一的& nbsp。所以我可以计算并给出填充而不是& nbsp

I just want to know the how many "px" occupy the single "&nbsp". so that i can calculate and give the padding instead of &nbsp

推荐答案

这是不可能知道这一点,取决于字体的度量和它的呈现方式。不间断的空间通常以与同一字体中的常规空间相同的宽度呈现,它只是建议浏览器不要在那一点换行或折叠空间。

It's not possible to know this accurately, because it will depend on the font's metrics and the way it's rendered. A non-breaking space is usually rendered with the same width as a regular space in the same font, it just suggests to the browser not to wrap at that point or collapse the space.

您不应该依赖于以特定方式呈现的字体,以便在页面上排列设计元素。以适当的单位指定距离,在不适合的情况下不要使用不间断的空格。

You should never rely on fonts rendering a particular way in order to line up design elements on the page. Specify distances in units that are appropriate, and don't use non-breaking spaces in situations for which they aren't suitable.

您可以从值开始,例如 0.4em 。但是如果你绝对必须完全匹配一个不间断的空间的宽度,你正在使用一个不间断的空间。

You could start with a value of, say, around 0.4em. But if you absolutely have to exactly match the width of a non-breaking space, you are using a non-breaking space incorrectly.

这篇关于有多少px占据单一?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆