< span>+< sup>由换行引起的中间空格 [英] <span> + <sup> having a white-space inbetween caused by a line-break
问题描述
以下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)
将换行符定义为回车符(

),即一行提要(

),或回车符/换行符对.所有换行符构成空白.
A line break is defined to be a carriage return (

), a line feed (

), or a carriage return/line feed pair. All line breaks constitute white space.
http://www.w3.org/TR/html401/struct/text.html#line-breaks
这篇关于< span>+< sup>由换行引起的中间空格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!