Geeks With Blogs

News INETA Community Speakers Program WTFNext's hosting!

View Stacy Vicknair's profile on LinkedIn

WTF Next? Dev ramblings from a master of nothing.

I mashed together a variety of random web resources on how to make a decent pre tag for code and the output looks like this (ignore how incredibly bad this code is... I was testing SVN and making sporadic changes... Steve McConnell would strangle me):

Module Module1
    Sub Main()
        Console.BackgroundColor = ConsoleColor.DarkBlue
        Console.ForegroundColor = ConsoleColor.White


        Dim sw As New Stopwatch()

        Dim username As String = My.User.IsInRole(ApplicationServices.BuiltInRole.Administrator).ToString

        Console.WriteLine("User is admin: " & username & "!")
        Console.WriteLine("Time: " & sw.Elapsed.ToString)

    End Sub
End Module

There’s word wrap, and it’s at least differentiated from the rest of the post nicely IMO. the code is as follows:

pre {border: solid 1px #CCCCCC;

 font-size: 1.3 em;
 margin: 10px;
 background: #EEEEEE;

white-space: pre-wrap;
white-space: -moz-pre-wrap !important;
white-space: -pre-wrap;
white-space: -o-pre-wrap;
word-wrap: break-word;

Hope it helps some of you other code bloggers :)


Technorati Tags: ,,,
Posted on Tuesday, October 14, 2008 1:48 PM How-To | Back to top

Comments on this post: For those geeks that want decent looking <pre> code

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Stacy Vicknair | Powered by: