开发者

How I can put " within an HTML attribute value

开发者 https://www.devze.com 2022-12-31 20:03 出处:网络
I wish to have the following: <span title=\"This 开发者_运维问答is a \"good\" title.\">Catch me in the rice.</span>

I wish to have the following:

<span title="This 开发者_运维问答is a "good" title.">Catch me in the rice.</span>

It is obvious that this is not rendered well by the browsers. Please provide me with information of what escape sequence or encoding like " I must use?


Use &quot; instead.


Either replace the quotation mark with its corresponding HTML entity — e.g. &quot; or &#34;) — like this:

<span title="This is a &quot;good&quot; title.">Catch me in the rice.</span>
<span title="This is a &#34;good&#34; title.">Catch me in the rice.</span>

Alternatively you can use single quotes in your HTML in cases where you need double quotes in attribute values:

<span title='This is a "good" title.'>Catch me in the rice.</span>


<span title="This is a &quot;good&quot; title.">Catch me in the rise.</span>
0

精彩评论

暂无评论...
验证码 换一张
取 消