Jump to content

HTML5 and double quotes


mikhl

Recommended Posts

Hello. This is just a general curiosity question.

 

I am just wondering about peoples preferences with the use of double quotes in HTML5.

 

In XHTML and HTML5 the following is valid:

 

<div id="wrapper">

<div class="someClass">

	<p class="important">Some Content Here!</p>

</div>

</div>

 

However I hear that in HTML5 you can also choose to leave the double quotes out:

 

<div id=wrapper>

<div class=someClass>

	<p class=important>Some Content Here!</p>

</div>

</div>

 

I think it makes sense that they wouldn't be required. However, for the moment I am still using them to ensure there are no compatibility issues with any older browsers.

 

What do you think about this, do you think its a good idea?

What approach do you think we should be using now if we are coding HTML5 pages?

Link to comment
Share on other sites

While quotes are ostensibly optional for spaceless attribute values in HTML5, quotes are not optional for XHTML, and some parsers/browsers will not like unquoted strings.  There's no reason that I can see to not just "do it right" and quote all your attributes.

Link to comment
Share on other sites

Hmm. I agree, if your going to use quotes for multiple classes then you may as well keep to the convention and use them constantly. Seems like a better practice. Kind of like closing the <p> tag in my opinion is a must!!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.