views:

360

answers:

2

I'm looking for a way to customize my < code > and < pre > tags in my blog.

I'm in need of custom CSS styles/codes. Anyone able to guide me to a few good examples?

+2  A: 
code {
    font-family: Consolas, monospace;
}

There's an example! :)

Deniz Dogan
Very simplistic, that will work. But I was more inclined towards something like a block and1.2.3.with highlighting etc.I guess I'll have to do ajax/javascript for that, eh?
NoCanDo
If you want highlighting, I'd do it with a server-side language like PHP, or use a wordpress plugin that has already been created, such as: http://wordpress.org/extend/plugins/highlight-source-pro/
lhnz
A: 

The only thing I tend to like from <code> or <pre> blocks (incidentally, I'd advise against <pre> in general, since while it's still current it'd be better to use a descriptive named-div or span) is that it use a monospace font. Using a JS markdown script would be useful too. But from the CSS point of view:

pre,
code  {font-family: consolas, courier, monospace;
       font-size: 1em;
       line-height: 1.2em;
       white-space: pre; 
       background-color: #ccf; /* any colour's okay, 
       so long as it's different to the page-background  
       (for ease of recognition) and contrast to the text */
       color: #000; /* likewise the background-color comment */
       border: 1px solid #666;
       -moz-border-radius: 1em;
       -webkit-border-radius: 1em;
       border-radius: 1em; /* just in case */
       padding: 1em;
       margin: 1.2em 1em;
       width: 50%; /* or whatever you prefer */
       float: right;
       }
David Thomas