You are here:

HTML/Wrapping code

Advertisement


Question
Code Tags
Code Tags  
Hi Dan,
How can I wrap code on my web page.
You see a lot of code tags in forums, where you highlight the code and press the code tag button and the code is in a seperate box.
Some forums require you to type in the start and ending code for example.

[code] your text [/code]

But when I type this into the html on my web page, it just comes out how I typed it.

Please see the attached image for better understanding.

Thanks a lot.

Answer
Hi Paul,

You haven't asked a question here, but I am imagining you want to know why that doesn't work on your website?

Many forums have their own code language, called bbCode, which is what you've referenced.  There are some ways to get basic code display on your site very simply, but to allow you to have it color coded and such requires an external library.

on your website, instead of [code][/code] use the standard HTML code tags of .

If you want to keep your tabs, you'll also need to use the HTML preformatted text tag to keep your code preformatted.

In conclusion, try this:

YOUR CODE HERE


HTML

All Answers


Answers by Expert:


Ask Experts

Volunteer


Dan Stephenson

Expertise

I am a professional Web Designer & Developer. I work with HTML, XHTML and CSS every day, and would be glad to help with your problems, and answer your questions.

Experience


Experience in the area I have been a web designer/developer since 1997. I started developing websites with HTML 3.2 and using tables for layout. In 2006 I received my degree in Computational Media, and now work full time as a Webmaster and Interactive Media Author, as well as teaching continuing education courses on HTML, CSS and ActionScripting at my local college. Currently I design with XHTML and CSS - no tables and much cleaner and more accessible code and allows the designer more freedom and flexibility than tables.

Education/Credentials
New Media Production & Design Degree - SAIT Polytechnic

©2016 About.com. All rights reserved.