This forum is now read-only. Please use our new forums! Go to forums

0 points
Submitted by Jonas Andersson
about 11 years

Does using double or single quotes on attribute values make a difference in HTML?

I noticed that every other value thus far is embraced by single quotes(style=’color: red’). However in this tutorial, the colspan attribute is embraced by double quotes(colspan=”3”).

Does it make a difference which quotation mark I use, or is it just personal preference?

Answer 50cf98c7509178e0f600103a

1 vote



By default, SGML requires that all attribute values be delimited using either double quotation marks (ASCII decimal 34) or single quotation marks (ASCII decimal 39). Single quote marks can be included within the attribute value when the value is delimited by double quote marks, and vice versa. Authors may also use numeric character references to represent double quotes (") and single quotes ('). For double quotes authors can also use the character entity reference ".

I know in languages like SQL it matters, but in HTML it’s just preference. I’ve been told whichever is used, to just be consistent, but nothing will break because of it, unless you forget to close the quote of course.

Submitted by danessh
about 11 years


Jonas Andersson about 11 years

I know the ruby track here on codecademy mentions the implications of double vs single too. Thanks for the info

Answer 50cbb818621908b8a6002007

0 votes


I have a funny feeling that it’s just a bug that these guys still haven’t worked out. There’re a bunch throughout this course, or instructions that aren’t that descriptive etc.

It’s a good free product, but there is a reason it’s free.

Submitted by Benjamin
about 11 years


mckinsey2 about 11 years

Yeah, they want people to learn how to do it.