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
hum4n01d
25,493 PointsPutting HTML code in a <code> tag [SOLVED]
I am trying to make a website that includes an HTML example like this:
<code>
<!—Should be an indent…—><p>Hi</p>
</code>
But when I do that in an HTML document see here it renders as the HTML code. :(
Any thoughts are appreciated
3 Answers
Ryan Field
Courses Plus Student 21,242 PointsThe only real way to do this (without JavaScript) is to replace all of your opening tags with <, like this:
<p>Hi</p>
which will be rendered to:
<p>Hi</p>
in browsers.
Michael Fish
7,804 PointsHello,
For some reason this form isn't letting me show you exactly how. You use the less than and greater than markup and put the tag (such as div or p) in the middle. Your answer is on this site: http://www.w3schools.com/html/html_entities.asp
hum4n01d
25,493 PointsThanks!
Joseph Gennitti
16,870 PointsRyan is right put <p>Hi</p>
hum4n01d
25,493 Pointsok. Thanks!
hum4n01d
25,493 Pointshum4n01d
25,493 PointsThanks! That works