How to use css to change <pre> font size

user289346 picture user289346 · Mar 28, 2010 · Viewed 69.6k times · Source
pre{font-family:cursive;font-style:italic;font-size:xxx-small}

How to change pre font size?

Answer

Chris R picture Chris R · Nov 29, 2010

While the font-size cannot be changed for text directly inside pre tags, you can always wrap that text in another element (a span, for example) and change the font size of that element.

For example (this is inline-styles, but could be put in CSS if you wanted):

<pre><span class="inner-pre" style="font-size: 11px">
Blah blah
Multiple lines and no br's!
Oh yeah!
</span></pre>