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


How can I add html tags as html text?

I want to add img html tags in my p (paragraph) in html, but it breaks my text, assuming I'm trying to actually input an image. But I just want the img to show up as "img" with the less than and greater than signs around it in my paragraph. How can I do this?

For example, in C++ or Java you'd just add something like a forwardslash before a reserved character and it ignores it.

3 Answers

Thank you both!

Erick Kusnadi
Erick Kusnadi
21,615 Points

You would use an HTML Entity.

You can see here for a list of entities: http://www.w3schools.com/html/html_entities.asp

And an example here:

<!DOCTYPE html>

<html> <head> <title>HTML Entities</title> </head>

    <p>Use an HTML entity. &lt; img &gt; </p>