Is it possible to to change a <span> tag (or <div>) to preformat its contents like a <pre> tag would using only CSS?
Look at the w3C defaults. Copy all the settings for PRE and put them into your own class.
Specifically, the property you're looking at is:
white-space: pre
http://www.quirksmode.org/css/whitespace.html
http://www.w3.org/TR/CSS21/text.html#white-space-prop
Why not just use the <pre> tag, instead of the span tag? Both are inline, so both should behave in the way you would like. If you have a problem overriding the entire definition of <pre>, just give it a class/id.
This isn't possible using just css.
However you can do it clientside using javascript. A good library such as jQuery would help you there.
Or serverside by processing the html. There you could possibly use xml tranforms or a regular expressions.
Could you describe in more detail what you are trying to accomplish.
This makes a SPAN look like a PRE:
span {
white-space: pre;
font-family: monospace;
display: block;
}
Remember to change the css selector as appropriate.