Hi, one of the people commenting here asked for a way of displaying code in one of my themes.
For ages I have been using the following code and it worked flawless in connection with the code markup plugin for wordpress:
.primary pre#hack {
white-space: pre-wrap; /* css-3 */
white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
word-wrap: break-word; /* Internet Explorer 5.5+ */
}
.primary pre {
overflow: auto;
cursor:pointer;
position:relative;
}
.primary pre code {
display: block;
margin:10px;
padding:4px;
border:1px solid #ddd;
background:#F5F5F5;
font:10px Lucida Sans Typewriter, Courier, monospace;
}
.primary can be changed to what you need, e.g. .post or .entry
Usage within Wordpress
Simply go to the “code” editor of Wordpress and paste your code.
Surround it by a < pre > and < code > tag and add the id of “hack” to the < pre >.
(< pre id="hack" >< code > stuff here < / code > < / pre >
If you enjoyed this post, make sure you subscribe to my RSS feed!
Related posts:
- Wordpress Themeviewer opened again Hooray fo
- Buddypress This week
- Wordpress 2.6 released – not upgrading for now? Hello ever
- Wordpress 2.8-beta1-11402 Quite fran
- Wordpress 2.7 to be released tomorrow Is tomorro
Tagged with: code • css • display • Wordpress



1 Comment
Jump to comment form | comments rss [?] | trackback uri [?]