Reply to Re[2]: [PHP] quoting values in HTML - is there a diference between ' and "

Your name:

Reply:


Posted by Richard Davey on 01/20/05 17:18

Hello,

Thursday, January 20, 2005, 2:55:09 PM, you wrote:

tpgc> I believe HTML uses ' and " interchangeably. No real difference.
tpgc> Well, it also depends on the HTML rendering engine too I guess.
tpgc> IE might do it ok but Firefox might not.. things like that. But
tpgc> I think as far as the spec goes, you can use both.

In HTML 4.1 at least the atrribute values can be delimited using
either single or double quotation marks. I doubt there are many
rendering engines that would be specific to one type, othewise
something like this wouldn't be possible:

<img src="blah.gif" alt="Look, it's an image" />

You can use numeric character references instead of quotes if you
like.

tpgc> In a lot of cases, as long as there are no spaces involved, you
tpgc> can go without the quotes too but that's just really poor coding
tpgc> practice I think.

From the spec:

"In certain cases, authors may specify the value of an attribute
without any quotation marks. The attribute value may only contain
letters (a-z and A-Z), digits (0-9), hyphens (ASCII decimal 45),
periods (ASCII decimal 46), underscores (ASCII decimal 95), and colons
(ASCII decimal 58). We recommend using quotation marks even when it is
possible to eliminate them."

Bear in mind this is the HTML 4.1 spec - the XHTML spec is vastly
different and non-quoted attributes will fail validation big time.

Best regards,

Richard Davey
--
http://www.launchcode.co.uk - PHP Development Services
"I am not young enough to know everything." - Oscar Wilde

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация