为什么在span类中显示break标记?

时间:2015-10-05 16:16:12

标签: html css tags line-breaks break

<div class="marker m2">
<span class="hint--top" data-hint="Here is a marker with more text!">
<div class="inner-marker"></div></span></div>

上面的代码不允许在“data-hint”文本中使用换行符。我在break标签上尝试了不同的变化,但它仍在我的句子中显示。不会发生换行。

1 个答案:

答案 0 :(得分:2)

&#13;
&#13;
.hint--top::after {
  content: attr(data-hint);
  white-space: pre-wrap;
}
&#13;
<div class="marker m2">
<span class="hint--top" data-hint="Here is a marker
with more text!">
<div class="inner-marker"></div></span></div>
&#13;
&#13;
&#13;