gpt4 book ai didi

HTML emsp 实体确切行为

转载 作者:行者123 更新时间:2023-12-05 04:11:35 29 4
gpt4 key购买 nike

我无法找到 HTML emsp 实体行为的准确引用。我查看了 W3.org、MDN、W3schools 和此处,但我还没有找到描述其在未应用任何特殊样式的 HTML 中的中断或包装行为的描述。

下面的代码显示了我进行的一个实验,但我仍然对它何时回绕和何时不回绕感到困惑。有好的引用吗?

<!DOCTYPE html>
<html>
<style>
body {
font-size: 20px; font-family: Courier, fixed;
}
</style>
<body>

<p>Following is some text with some embedded emsp entities.<br>Here is one mid-word: sam&emsp;ple. <br>And here is one on each side of a dash: lock&emsp;-&emsp;step.<br>Then, how about one after a period?<br>Right after the next period is one and then a normal space.&emsp; How about the standard space and then the emsp?<br>That sequence follows this sample sentence. &emsp;(Note that since the regular space came first, this can cause this text after it to become indented, whereas the emsp-then-regular space occurrence just before will never do that, I think.) As long as I'm looking at them after the end of a sentence, we should try putting just one emsp after a sentence instead of the regular space caracter.<br>I thought that would stick the two sentences together, but it does not do so here.&emsp;Indeed, this is consistent with its behavior mid-word. Okay, how about multiple occurrences of it?<br>There are 3 in the brackets here: [&emsp;&emsp;&emsp;] and so on. I played with that last one a bit and I cannot get it to break after the 3 emsps. Here, they seem to keep their width (they are not combined into one) and they are not breakable, not even either before the first or after the last one. So, I seem to only be able to get the "[" and never the "]" as the first character on a new line.<br>Okay, more extremely, trying brackets around 5 emsp chars, a word, and 5 more emsp chars: [&emsp;&emsp;&emsp;&emsp;&emsp;word&emsp;&emsp;&emsp;&emsp;&emsp;] .<br>There we seem able to break before "word", but still never before "]". What's going on there?
</p>
<p>From the examples above, I think the mystery around emsp characters is mostly resolved for me.</p>
<p>Consider the standard behavior for a regular space character. Here, first remember that multiple occurrences of regular whitespace characters are all compressed as if they were a single regular space character. Then, of course, the regular space character takes a certain width, and lines are never broken just before the regular space, only after it. And the space normally allocated for a regular space character does not need to be rendered at the right edge of a box.</p>
<p>Similarly, text can break after an emsp character, but will not do so before. It is wider than a regular space character, but mostly behaves like it. Where it differs is if you have multiple emsp entities right next to each other. In that case, no break will occur before, within, or after the group (unless there is whitespace before or after it, in which case the whitespace is the location of the break). But if a set of multiple emsp characters are placed directly between two non-white characters (as in the bracket example above) then they are not compressed and no breaking occurs. That's all I'm thinking of at the moment ...</p>

</body>
</html>

最佳答案

emsp 是一个与字母“M”等宽的空白

我在 http://opencoder.net/emsp.html 找到了一个简短的描述

无论是断行还是非断行,我认为最简单的方法就是测试它。

关于HTML emsp 实体确切行为,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42463838/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com