简体   繁体   中英

Can a single character be underlined in alt text in img element

We have a need to underline a character in a client's name. How do I do it in alt attribute of img element?

<img alt="ab<u>c</u>def" />
<img alt="ab&lt;u&gt;c&lt;/u&gt;def" />
<img alt="ab<span style='text-decoration:underline;'>c</span>def" />

I expect the output to be underlined 'c' but actual output is literal.

It can't. HTML entities don't work in tag attributes, only between tags.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM