Wednesday 15 April 2009

Showing Code on Your Webpage

Showing Code on Your Webpage

I am not a computer geek. I just learn by experience and trial and error and find stuff that works. Sometimes we want to show code on the page. If we just write this in the usual way it won't show because it is active. I have found two ways of presenting code on the page. The first is to change the symbols such as "<" or ">" (the beginning and end of the tags) with a replacement symbol. They are set out below.
What you want to showWhat you replace it with
"&quot;
'&apos; (except IE)
&&amp;
<&lt;
>&gt;

For example, for the title tag <title> you type in &lt;title&gt;

The second way is easier - use Google Docs. Just prepare the Blogger post in Google Docs and ignore any problems with code. Type it as if it was ordinary text. Then publish the document to Blogger per these instructions. This page was prepared in Google Docs.

Here is some code that makes a simple table that I just dumped into this page:

<table style="text-align: left; width: 50%;"
border="1" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
</tbody>
</table>

What happens is this. When the document is published from Google Docs to Google Blogger the active code is deactivated. In the compose window you will see all the symbols changed automatically for you! Man, this is cool as it saves so much time and is far more accurate. It is very fiddly substituting bits of code with odd meaningless letters and symbols.



P.S. Thanks to www.tutorialtastic.co.uk for the list of code subsitutions in the table on this page.

No comments:

Post a Comment

Your comments are always welcome.

Featured Post

i hate cats

i hate cats, no i hate f**k**g cats is what some people say when they dislike cats. But they nearly always don't explain why. It appe...

Popular posts