How To Write Ampersand Sign in Attribute Values

Q

How To Write Ampersand Sign in Attribute Values? - XHTML Tutorials - Introduction To Tag and Attribute Syntax

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

2007-05-12, 5007👍, 0💬