Wordwrap that PRE!

0 min read 91 words

Ever used a <PRE> in a limited width div container? You will notice that the line gets cut off almost as if word-wrap was not enabled.

To correct this you can add the following code into your CSS file.

pre{
  white-space: pre-wrap; /* CSS2.1 compliant */
  white-space: -moz-pre-wrap; /* Mozilla-based browsers */
  white-space: o-pre-wrap; /* Opera 7+ */
}

This code was originally found somewhere else online but I found it really useful so reposted it!
If you’re the original author then comment and let us know 🙂

P.S. Thanks 😉

Tags:
Andrew
Andrew

Andrew is a visionary software engineer and DevOps expert with a proven track record of delivering cutting-edge solutions that drive innovation at Ataiva.com. As a leader on numerous high-profile projects, Andrew brings his exceptional technical expertise and collaborative leadership skills to the table, fostering a culture of agility and excellence within the team. With a passion for architecting scalable systems, automating workflows, and empowering teams, Andrew is a sought-after authority in the field of software development and DevOps.

Tags

Recent Posts