Is this the right way to use escape characters in alt
attributes for alt text of an img
element?
I have the below code:
<h3>Option 1</h3> <img src="image.jpg" alt='Version of "Whistler\'s Mother" in cubist style'> <br><br> <h3>Option 2</h3> <img src="image.jpg" alt="Version of \"Whistler's Mother\" in cubist style">
Either of the two options above do not work properly as the alt text. The alt text that I wanted to display is:
Version of "Whistler's Mother" in cubist style
No, use the HTML entity instead. Eg '
or "
:
<h3>Option 1</h3> <img src="image.jpg" alt='Version of "Whistler's Mother" in cubist style'> <br><br> <h3>Option 2</h3> <img src="image.jpg" alt="Version of "Whistler's Mother" in cubist style">
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.