Span new line span

2019-05-08 03:44发布

<span>A</span>
<span>V</span>

Causes a space between these letters, how is this calculated excatly? As oppose to

<span>A</span><span>V</span>

3条回答
对你真心纯属浪费
2楼-- · 2019-05-08 04:13

span is an inline element like the simple text so it follow the same style rules. When you write on a new line the rendering put a white space.

A
B

will become "A B", with a whitespace between A and B. This happen also with strong or em

查看更多
Melony?
3楼-- · 2019-05-08 04:26

Try using a class on span which will force the second span to new line and the CSS as

 .spanClass 
 {
    display:block;
 }
查看更多
Explosion°爆炸
4楼-- · 2019-05-08 04:28

Whitespace between inline elements is compressed (or converted if it's something other than spaces) to a single space and displayed.

The W3C specification has more information:

This layout may involve putting space between words (called inter-word space), but conventions for inter-word space vary from script to script. For example, in Latin scripts, inter-word space is typically rendered as an ASCII space (&#x0020;).

查看更多
登录 后发表回答