Wednesday, November 16, 2005

CSS - Cool pre formatting effect

On PlanetMySQL, I noticed a cool pre style. You can also try by placing CSS code similar to following for pre HTML tags.


.phpcode, pre {
overflow: auto;
padding-left: 15px;
padding-right: 15px;
font-size: 11px;
line-height: 15px;
margin-top: 10px;
width: 93%;
display: block;
background-color: #eeeeee;
color: #000000;
max-height: 300px;
}


Long text of code that never ends cause we just want to demonstrate the css effect here on this very very very long line.


3 Comments:

At Thu Jan 12, 02:50:00 AM, Anonymous Anonymous said...

Very cool, thanks for pulling this out and passing it on! I've been going nuts trying to get my Pre tags to no override my other columns in my blog. I didn't know CSS could do something this cool.

 
At Thu Jan 12, 06:40:00 AM, Blogger Frank said...

Hanford,
Ever since I found this CSS effect, I have been using it on most of my sites. CSS is pretty powerful indeed.

I am glad this post was able to help you. Let me know if you have any questios or need assistance in any thing.

Thanks
Frank Mash

 
At Fri Feb 01, 04:45:00 AM, Anonymous Anonymous said...

Tried using pre tag..but it always aligns my text to the center of the screen...Any way of avoiding the center alignment with pre tag....I want the default left alignment in the JSP for the text enclosed within the pre tag

 

Post a Comment

<< Home