• Advertisement

# HTML5 (Quotes around href links?)

This topic is 2135 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

## Recommended Posts

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[/color] as opposed to [color=#0000ff]href="../index.php"[/color].

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

#### Share this post

##### Share on other sites
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 [url="http://dev.w3.org/html5/spec/Overview.html#a-quick-introduction-to-html"]this section[/url]:
[quote]
Attributes are placed inside the start tag, and consist of a name and a value, separated by an "=" character. [b]The attribute value can remain unquoted if it doesn't contain space characters or any of " '  = < or >[/b]. 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)

#### Share this post

##### Share on other sites
[quote name='Cornstalks' timestamp='1331865717' post='4922463']
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 [url="http://dev.w3.org/html5/spec/Overview.html#a-quick-introduction-to-html"]this section[/url]:
[quote]
Attributes are placed inside the start tag, and consist of a name and a value, separated by an "=" character. [b]The attribute value can remain unquoted if it doesn't contain space characters or any of " '  = < or >[/b]. 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)
[/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.

#### Share this post

##### Share on other sites
[quote name='coderWalker' timestamp='1331866016' post='4922464']
I knew there were specifications someone online, but I wasn't 100% sure, and there are millions of HTML5 pages.
[/quote]
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.

#### Share this post

##### Share on other sites
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.

#### Share this post

##### Share on other sites

• Advertisement