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;.

 

HTML Tag and Attribute Syntax

⇒⇒HTML Tutorials

2017-02-20, 228👍, 0💬