To see the line breaks correctly when using Textarea


I have a table article, that among its variables this $texto , and that when creating, a row, the value of this variable is requested by textarea .

But after having created it, I find this:

I had placed a couple of line breaks, but when displayed on the screen, HTML translates it as a single space. This is how I show the text of the Article:

<h3 class="text-left">{{$articulo->texto}}</h3>

How would you get it to be displayed in a way that respects the line breaks that you entered in the form?

More information: Something that probe is the use of the <pre> tag, which allows the text to be displayed in its original state.

<h3 class="text-left"><pre class="text-left">{{$texto}}</pre>

But it gives me this result:

Obviously, I would like the user not to have to press a bar to read the entire text. How do I show the line breaks, but seeing everything on the screen?

asked by Miguel Alparez 15.11.2018 в 10:07

1 answer


I already found a solution:

<span class="{{$eficiencia}} text-left" style="white-space: pre-line;">{{ $u->ocupacion->descripcion }}</span>

Thanks to this I have finally managed to show the line breaks.

answered by 15.11.2018 в 12:16