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 trial

HTML

Jacky Chau
seal-mask
.a{fill-rule:evenodd;}techdegree
Jacky Chau
Full Stack JavaScript Techdegree Student 8,106 Points

HTML Entities

It is said that some characters are reserved in HTML, like ">" and "<" . So, instead of writing n>5 , we should write n&gt5

However, I tried writing n>5 and the browser could still show the ">" sign successfully. So, is character entity just unnecessary?

Thank you.

1 Answer

Steven Parker
Steven Parker
231,007 Points

Reserved characters might get printed correctly in some cases, but relying on them to print as they are will make your code "brittle" to future changes. Using the character entity guarantees proper display both now and after possible future page modifications and/or across different browsers.

Also, character entities begin with an ampersand ("&") and end with a semicolon (";"). So the correct sequence to display "n>5" would be "n&gt;5".