This forum is now read-only. Please use our new forums! Go to forums
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
from w3.org:
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.
Answer 50cbb818621908b8a6002007
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.
1 comments
Yeah, they want people to learn how to do it.
Popular free courses
- Free Course
Learn SQL
In this SQL course, you'll learn how to manage large datasets and analyze real data using the standard data management language.Beginner friendly,4 LessonsLanguage Fluency - Free Course
Learn JavaScript
Learn how to use JavaScript — a powerful and flexible programming language for adding website interactivity.Beginner friendly,11 LessonsLanguage Fluency - Free Course
Learn HTML
Start at the beginning by learning HTML basics — an important foundation for building and editing web pages.Beginner friendly,6 LessonsLanguage Fluency
1 comments
I know the ruby track here on codecademy mentions the implications of double vs single too. Thanks for the info