-1

I wish to display pre-formatted text as stored in a MySQL database but want to avoid displaying the text in the fixed-width font that <pre> imposes

Or am I mistaken that imposes any particular font but merely defaults to fixed-width?

Alastair McCormack
  • 26,573
  • 8
  • 77
  • 100
D.Hussey
  • 23
  • 3

2 Answers2

1

The same way you use a variable width font in any other element: With the CSS font-family property.

pre { font-family: helvetica, sans-serif; }
<pre>Hello
    World</pre>
Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
-2

Found a solution .... adding white-space: pre-wrap; to the CSS style for the element displaying the text achieved the result I was looking for

Alastair McCormack
  • 26,573
  • 8
  • 77
  • 100
D.Hussey
  • 23
  • 3