html段落前的空格,HTML空格:空格前后

我正在努力更好地了解

HTML空白处理模型.现在我正在比较两个HTML片段:

a
z

a
z

第一个代码片段被重绘时,会产生两行:“a”和“z”(所以第一行有一个尾随空格).

第二个片段产生两行:“a”和“z”.第二行没有领先空间.

If a space (U+0020) at the beginning of a line has ‘white-space’ set to ‘normal’, ‘nowrap’, or ‘pre-line’, it is removed.

All tabs (U+0009) are rendered as a horizontal shift that lines up the start edge of the next glyph with the next tab stop. Tab stops occur at points that are multiples of 8 times the width of a space (U+0020) rendered in the block’s font from the block’s starting content edge.

If a space (U+0020) at the end of a line has ‘white-space’ set to ‘normal’, ‘nowrap’, or ‘pre-line’, it is also removed.

If spaces (U+0020) or tabs (U+0009) at the end of a line have ‘white-space’ set to ‘pre-wrap’, UAs may visually collapse them.

对此的幼稚阅读将表明,由于要删除行的开头或结尾的空格(当“空白”为“正常”)时,我的第一个片段应该不会导致尾随空格.但事实并非如此.

发生什么了?

我目前的理论是< br>被秘密地算作一个“字符”,在第一个代码片段中,它阻止了尾随空格处于其行的“结束”.但我真的不知道.

编辑:要清楚,我知道如何使用& nbsp;随意创建空格.我的问题是关于什么规则(关于某些规范)会引起上述行为.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值