小编典典

如何在标题属性中转义双引号

html

我正在尝试使用在锚的title属性中包含双引号的字符串。到目前为止,我尝试了这些:

<a href=".." title="Some \"text\"">Some text</a>
<!-- The title looks like `Some \` --!>

<a href=".." title="Some &quot;text&quot;">Some text</a>
<!-- The title looks like `Some ` --!>

请注意, 不能 使用单引号。


阅读 284

收藏
2020-05-10

共1个答案

小编典典

这个变体-

<a title="Some &quot;text&quot;">Hover me</a>

是正确的,并且可以正常工作-您在呈现的页面中看到正常的引号。

2020-05-10