Ampersand Sign in HTML Attribute Values

Q

How To Write Ampersand Sign in Attribute Values?

✍: FYIcenter.com

A

If you need enter an ampersand sign in an attribute value, you can not enter it directly. You must replace it with entity: &.

Here are some interesting examples of quoted attribute values:

  • <img src="/tt.gif" alt="Tutorials &amp; Tips"/> - Valid.
  • <img src="/tt.gif" alt="Tutorials & Tips"/> - Invalid, & must be replaced by entity &amp;.

 

Attributes Required by HTML Elements

Quoting HTML Element Attribute Values

HTML Tag and Attribute Syntax

⇑⇑ HTML Tutorials

2023-09-23, 1502🔥, 0💬