简体   繁体   English

解释为什么在此内联元素中空格消失了?

[英]Explain why white space disappears in this inline element?

http://jsbin.com/sedisuhigo/edit?output http://jsbin.com/sedisuhigo/edit?output

notice that there is white space after "l" in first instance while its not there in the second instance. 请注意,在第一个实例中的“ l”后面有空白,而在第二个实例中则没有空白。

It will be great if someone can point to some specification explaining this behaviour? 如果有人可以指出一些说明这种行为的规范,那将是很好的? I couldnt find any explaination? 我找不到任何解释?

Each 'a' element is independent by itself. 每个“ a”元素本身都是独立的。 For each element you declared underline but you have also defined a margin between them so there is a space. 对于声明为下划线的每个元素,但您还定义了它们之间的边距,因此有一个空格。

To reach your goal you should wrap them with a container and declare underline over there. 为了达到您的目标,您应该将它们包装在容器中并在其中声明下划线。

Here is an option for that: 这是一个选项:

<body> 
  <div class="underline-me">
    <a id="one">
      expol
    </a>
    <a id="two">
      expol
    </a>
  </div>
</body> 

and for the css: 对于CSS:

a{
  /* text-decoration: underline; */
  font-size: 4em;
  /* margin: 2px; */
}
.underline-me{
  text-decoration: underline;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM