Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJeremiah Lugtu
737 PointsDo you have to use all HTML Entities all the time? and why?
I mean aside from convention?
For example in the video "©" was used when you can just type it and it would yield the same results (Alt/Option + G)
Both shows up in the browser and no error comes up in the HTML validator.
So is it okay to just type the copyright symbol?
This question only pertains to certain entities such as the example used... obviously it does not include brackets (</>) and such
Thanks :)
1 Answer
Sergey Podgornyy
20,660 PointsYou don't generally need to use HTML character entities if your editor supports Unicode. Entities can be useful when:
- Your keyboard does not support the character you need to type. For example, many keyboards do not have em-dash or the copyright symbol.
- Your editor does not support Unicode (very common some years ago, but probably not today).
- You want to make it explicit in the source what is happening. For example, the
code is clearer than the corresponding white space character. - You need to escape HTML special characters like
<
,&
, or"
.
Jeremiah Lugtu
737 PointsJeremiah Lugtu
737 PointsThanks a bunch! :D
Sergey Podgornyy
20,660 PointsSergey Podgornyy
20,660 PointsYou are welcome ;)