HTML相当于& nbsp; ......这会打破; [英] HTML equivalent to   ...that DOES break;

查看:134
本文介绍了HTML相当于& nbsp; ......这会打破;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



If I want to force two visually displayed two spaces I can do this:

FOO BAR  FOO BAR

这会避开HTML的空白折叠功能,但它也会导致像这样的换行符:

This would sidestep HTML's whitespace collapsing feature, but it also would result in line breaks like this:

FOO 
BAR  FOO 
BAR

是否有一个替代品可以像一个常规空间那样起作用?这是我所问的伪代码:

Is there a replacement that would act like a regular space that does break? Here's pseudo code for what I'm asking:

FOO
BAR&bsp;&bsp;
FOO
BAR

ps:我知道这可以用CSS完成。不是我在这里感兴趣的。

ps: I know this can be done with CSS. Not not what I'm interested in here.

推荐答案

如果你想要一个不会阻碍(U + 2002,& ensp; )或em空格(U + 2003,& EMSP; )。通常情况下,en空间的宽度是普通空间的两倍,em空间宽度是其四倍。

If you want a wider-than-normal space that doesn't prevent line breaks, you probably want either an en space (U+2002,  ) or an em space (U+2003,  ). Typically, an en space is twice as wide as a normal space, and an em space is four times as wide.

这篇关于HTML相当于& nbsp; ......这会打破;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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