1

I have been tiring to put some text into border that I did.

div {
  background-color: lightgrey;
  width: 200px;
  border: 15px solid crimson;
  padding: 50px;
  margin: 20px;
}
<div>
  <pre>
    Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text.
     </div>
            </pre>

Now I have a lot of text that i want to put inside the border. I'm using pre tag and it looks like this:

enter image description here

I'm trying to understand how to put the text inside the border, but everything that I have tried doesn't work. What can I do to fix it?

isherwood
  • 58,414
  • 16
  • 114
  • 157
MaROM
  • 85
  • 1
  • 6
  • Why do you want to use
     when you don't want the text be printed "preformatted" as written in the HTML file?
    – Progman Nov 05 '21 at 17:34

1 Answers1

0

Use white-space: pre-wrap.

div {
  background-color: lightgrey;
  width: 600px;
  border: 15px solid crimson;
  padding: 50px;
  margin: 20px;
}
pre {
  white-space: pre-wrap;
}
Dave S
  • 614
  • 4
  • 6