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 HTML Basics Going Further with HTML HTML Entities and Reserved Characters

how to write an entity code without it turning into the entity?

just out of curiousity, lets say for example i wanted to type in the entity code " &a mp; " without it turning in the actual " & " ? how would that be done. thanks

John Lack-Wilson
John Lack-Wilson
8,181 Points

Hi Mohammed, not sure what you mean by you want to type in the code " & " without it turning in the actual " & " ?.

2 Answers

Marouen Helali
Marouen Helali
1,599 Points

Hi,

use escape sequences. You would need to use / before special characters for them to appear as they are. For example, /& would appear as &, /" would appear as " instead of working as a string indicator.

Hope this helps!

Jonas Lee
Jonas Lee
27,296 Points

Well you could create a PHP file and use an escape sequence '/'. To do this, in the element you are specifying such as <h1> or <p> you would start with the opening php tags <?php ?> and inside type the echo function.

<?php echo "/& amp;" ?>

You don't have to use PHP but it's a very good tool that has many different functions :) Hope this helps!