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
David Collins
Courses Plus Student 2,598 PointsThe <code> tag
In my note, they say this, about the code tag The <code> tag is a phrase tag. It defines a piece of computer code. I understand what a phrase is. I wrote this out in my text editor like this I use the code tag and the paragraph tag
<code> Hello World!</code>
<p> Hello World!</p>
Basically they both comes out the same, on my webpage My question is, what do they mean when they say its a piece of computer code and what is its purpose? a piece of computer code dose it look like this (1010101010) I'm not sure
2 Answers
Craig Watson
27,930 PointsHi David,
The "code" tag should be used when on your website you require the ability to post a code snippet for example. The browser will interpret this tag and execute the code within it as raw text. To see this tag in work you would need to but some HTML tags within it like below:
<code>
<div>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
</p>
<span>
This should all have a default code looking font not so appealing on the eye!
</span>
</div>
</code>
When this is interpreted by the browser it will not execute the code within the code tag, it will simply display the code all as text on the screen...
Hope this makes scene and helps you!
Craig
David Collins
Courses Plus Student 2,598 PointsThank you Craig I was confused about that. Yes it help me thank you again