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

How do I include code in my content as text so it is viewable to the reader and not used as actual code?

I'm creating a coding blog as a reference tool. I basically just want code viewable on my page...

'<!DOCTYPE HTML> - you will always include this at the start of your html document'

all that is viewable on my page is '- you will always include this at the start of your html document'

<plaintext> Does seem to work but it is obsolete now and won't work on all browsers... I'll try to find a replacement.

4 Answers

Hi Rebecca,

One thing would be to change the opening and closing triangular brackets to be &lt; (less than) and &gt; (greater than).

This Stack Overflow question has a few other suggestions.

Hope that helps :)

-Rich

Thats exactly it :) Thankyou :)

No problem :)

-Rich

Please be more specific !

I'm creating a coding blog as a reference tool. I basically just want code viewable on my page...

'<!DOCTYPE HTML> - you will always include this at the start of your html document'

all that is viewable on my page is '- you will always include this at the start of your html document'

This seems to show the code in the browser without it interpreting it as code... <!doctype html>

Typically you'll want to use the markdown or code tags your blog software uses.

Otherwise your HTML will get interpreted as...HTML and get rendered rather than shown verbatim.