如何在跨度文本中换行?

How to make new line in span text?

我有这个小代码 (php):

echo "<span class='hint--bottom' data-hint='$nickname <br /> swag'><img src='https://cravatar.eu/helmavatar/$nickname'width='29px' height='29px' /></span> ";

当我尝试在网站上 运行 时,我得到的是:

Polowicer <br /> swag. - Its a text.

如何向该数据提示添加(如果可能)<br />

我试过 \n, \r\n 并且 none 成功了。

如果您正在使用 hint.css,则需要更改一些 CSS 以使其正常工作,然后您可以使用字符 &#10;

创建中断

  .hint:before, .hint:after, [data-hint]:before, [data-hint]:after {
 white-space : pre!important;
  }
<!DOCTYPE html>
<html>
  <head>
    <title></title>
    <link href="http://kushagragour.in/lab/hint/hint.min.css" type="text/css" rel="stylesheet" />
  </head>
  <body>
    <br />
    <br />
    <br />
    <p>
 <a href="#" class="hint--top" data-hint="Yeah,&#10; I am >:D">Look, there is something over me.</a>
    </p>
  </body>
</html>