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
Francisco José Martín Soto
8,888 PointsHTML tag and <code> tag
Hi everyone, I'm writing example source code, and inside this code, there are tags like <div> <a> <li> ... Well, for the rest of the code I write inside <code> tags, JavaScript for example, there is no problem, but when I write HTML tags the browser process them as part of the file markup structure, and doesn't show the code itself.
1 Answer
nvcxnvkldsjaklfds
Courses Plus Student 5,041 PointsYes true. I had the same problem. I fixed them by applying character entities. You should use character entities instead <, !, > and so on.
Let me show you an example.
<code>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
</head>
<body>
</body>
</html>
</code>
You can find character entities for special characters http://dev.w3.org/html5/html-author/charref
I hope this helps. If you have any question please let me know.
Regards
Karthikeyan Palaniswamy
Francisco José Martín Soto
8,888 PointsFrancisco José Martín Soto
8,888 PointsThank you! I hope there not be the unique solution, I need to use it many times along my files. It must have a way to put the tags themselves.
nvcxnvkldsjaklfds
Courses Plus Student 5,041 Pointsnvcxnvkldsjaklfds
Courses Plus Student 5,041 PointsWelcome. Unfortunately, I just know this way. Please if you find a easy way let me know as well.
Steve McKinney
29,274 PointsSteve McKinney
29,274 PointsYou could use an online converter such as http://www.freeformatter.com/html-escape.html or use a php function called htmlentities http://php.net/manual/en/function.htmlentities.php.
To take one of the examples: