Lord have mercy on Lebanon. If you have anyone in Lebanon check on them. Pray for Lebanon 🙏🙏🙏
How do I wrap text in a pre tag?[SOLVED]

Definition and Usage

The pre tag defines preformatted text. 

Before you get to what brought you here, first take a second to under what the pre tag is.Text in this element is displayed in a fixed-width font, and it preserves both spaces and line breaks.

Incase you are wondering on how you can make the text word-wrap inside this pre tag instead of printing out one long line on small screen devices.Then you are in the right place.

Solution.

Place this simple css code in the styling sheet file linked to your webpage.


pre {
    white-space: pre-wrap;       /* Since CSS 2.1 */
    white-space: -moz-pre-wrap;  /* Mozilla, since 1999 */
    white-space: -pre-wrap;      /* Opera 4-6 */
    white-space: -o-pre-wrap;    /* Opera 7 */
    word-wrap: break-word;       /* Internet Explorer 5.5+ */
}

 

Hope this post helped you.

Related Post(s)

» How to center anything on a wepage using CSS

» Animated Social Media Icons Using Font Awesome and Materialize CSS

» Learn how to use CSS box shadow property - Source Code

» Learn how to create responsive images with CSS

» How to create a Fullscreen Background Video(Source Code)

collections_bookmark Category :: Css
date_range Published :: 1 year ago At: 10:21 AM
event_note Detailed Date :: Dec 03rd, 2018
person Writer :: Timothy

YOU MAY LIKE THESE POSTS

share