这似乎是一个非常基础的问题,但是...
在 HTML 代码中如何使用双引号(例如 alt 标签等)?
比如说...
我正在尝试在我的网页上设置一个标签为 Opening Credits for "It's Liverpool"
,但它只显示为 Opening Credits for
。
这似乎是一个非常基础的问题,但是...
在 HTML 代码中如何使用双引号(例如 alt 标签等)?
比如说...
我正在尝试在我的网页上设置一个标签为 Opening Credits for "It's Liverpool"
,但它只显示为 Opening Credits for
。
您需要使用相应的HTML实体来替换引号:
<span alt="Opening Credits for "It's Liverpool"">A span</span>
您可以通过使用适当的依赖于语言的引号来避免此问题,而不是Ascii引号,后者应仅在计算机代码中用作分隔符。例如:
alt="Opening Credits for “It’s Liverpool”"
alt="Opening Credits for ‘It’s Liverpool’"
alt='The statement foo = "bar" is an assignment.'
在极其罕见的情况下,如果属性值确实需要同时包含Ascii引号和Ascii撇号,则需要对它们进行转义(即您决定用作属性值分隔符的那个字符):
alt="The Ascii characters " and ' should not be used in natural languages."
或者
alt='The Ascii characters " and ' should not be used in natural languages.'
<strong>The Ascii characters " and ' should not be used in natural languages.</strong>