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
HTML5 (Quotes around href links?)
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)
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.
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.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement