< span>+< sup>由换行引起的中间空格 [英] <span> + <sup> having a white-space inbetween caused by a line-break

查看:81
本文介绍了< span>+< sup>由换行引起的中间空格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下HTML代码段用两个单词之间的空格(两行之间的换行符)呈现:

The following HTML snippet is rendered with a whitespace between the two words (with a line-break between both lines:

<span>foo</span>
<sup>bar</sup>

但是

<span>foo</span><sup>bar</sup>

呈现的两个单词之间没有空格.

is rendered without a whitespace between both words.

那么为什么换行符会导致这种现象.是否换行不应该影响此处的渲染!?

So why does the line-break cause this behavior. Line-break or not should not influence the rendering here!?

推荐答案

它们被视为空格,因此一个或多个换行符被视为单个空格(就像所有其他空格字符一样)

They are treated as white space, so one or more line-breaks are treated as a single whitespace (just like all the other white space characters)

将换行符定义为回车符(&#x000D; ),即一行提要(&#x000A; ),或回车符/换行符对.所有换行符构成空白.

A line break is defined to be a carriage return (&#x000D;), a line feed (&#x000A;), or a carriage return/line feed pair. All line breaks constitute white space.

http://www.w3.org/TR/html401/struct/text.html#line-breaks

这篇关于&lt; span&gt;+&lt; sup&gt;由换行引起的中间空格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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