HTML5 (Quotes around href links?)

Started by
3 comments, last by hplus0603 12 years, 1 month ago
I have come across something interesting on webpages, and that is sometimes the links are missing the quotes.
For example they read [color=#0000ff]href=../index.php as opposed to [color=#0000ff]href="../index.php".

I thought the scheme for HTML is and has always been variableName="data" ?

Just curious, are these quotes optional?
Should one include the quotes?
Does HTML no longer require quotes?

Thanks in advance,
CoderWalker
If this post was helpful please +1 or like it !

Webstrand
Advertisement
Remember that HTML5 has not yet been standardized. However, usually when there is a question regarding the specifications of a language, checking the actual language specifications can prove a fruitful adventure. I googled "html5 w3c" and found a working draft for HTML5, searched the page for "attribute" and quickly found this section:

Attributes are placed inside the start tag, and consist of a name and a value, separated by an "=" character. The attribute value can remain unquoted if it doesn't contain space characters or any of " ' ` = < or >. Otherwise, it has to be quoted using either single or double quotes. The value, along with the "=" character, can be omitted altogether if the value is the empty string.
[/quote]

(emphasis mine)
[size=2][ I was ninja'd 71 times before I stopped counting a long time ago ] [ f.k.a. MikeTacular ] [ My Blog ] [ SWFer: Gaplessly looped MP3s in your Flash games ]

Remember that HTML5 has not yet been standardized. However, usually when there is a question regarding the specifications of a language, checking the actual language specifications can prove a fruitful adventure. I googled "html5 w3c" and found a working draft for HTML5, searched the page for "attribute" and quickly found this section:

Attributes are placed inside the start tag, and consist of a name and a value, separated by an "=" character. The attribute value can remain unquoted if it doesn't contain space characters or any of " ' ` = < or >. Otherwise, it has to be quoted using either single or double quotes. The value, along with the "=" character, can be omitted altogether if the value is the empty string.


(emphasis mine)
[/quote]

Thanks a ton for the link to the specs as well as the answer! Much appreciated!
I knew there were specifications someone online, but I wasn't 100% sure, and there are millions of HTML5 pages.
If this post was helpful please +1 or like it !

Webstrand

I knew there were specifications someone online, but I wasn't 100% sure, and there are millions of HTML5 pages.

Yeah, I know how you feel. I've started to try and tell people how I find the answer, because I know there are times when I've been fascinated with "how did you know that" or "how did you find that" and so I'm experimenting with telling people how I know/found the answer.
[size=2][ I was ninja'd 71 times before I stopped counting a long time ago ] [ f.k.a. MikeTacular ] [ My Blog ] [ SWFer: Gaplessly looped MP3s in your Flash games ]
HTML traditionally does not require quotes for attribute values. There is/was a flavor of HTML called XHTML, where the HTML is also valid XML, which tightens up a lot of those problems. I personally like it a lot, but it's not what is "standard" on the web.
enum Bool { True, False, FileNotFound };

This topic is closed to new replies.

Advertisement