Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


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>