17
Feb

Code tag

   Posted by: Jesse Cole   in Site Stuff

Have you ever seen on websites where they show you some lines of code and those lines are seperated in a little box and clearly demarcated from the rest of the page? I’ve always wanted to be able to do that, now i can. I’ve edited the style.css page here and added a style for the code tag. Once i get it how i want it i’ll retroactively put code tags around all the code i’ve ever posted. See below for what i settled on.

pre {border: inset 1px blue;
font-size: 1.3 em;
color: blue;
margin: 10px;
padding:10px;
background: #fde8b9}

*Update*
I’ve finished adding the pre tags to the rest of the code on the site. That right i said pre tags. Turns out, pre, standing for “preformatted text”, reproduces exactly what is in the text including whitespace, etc. This was more useful than the code tags which don’t quite do that. Also, i found out that if you paste something from dreamweaver mx into a post and then save it, it drops everything after what you pasted and crashes the browser. So…don’t do that.

This entry was posted on Sunday, February 17th, 2008 at 4:48 pm and is filed under Site Stuff. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

One comment

 1 

pre tags are good for blocks of code. code is good for inline code.

By the way, is this in WP 2.5? It still works.

February 28th, 2008 at 9:16 pm

Leave a reply

Name (*)
Mail (will not be published) (*)
URI
Comment