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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux