Jump to content
  • Advertisement
Sign in to follow this  
coderWalker

HTML5 (Quotes around href links?)

This topic is 2408 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 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

Share this post


Link to 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 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)

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to 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


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!