Skip to content
Advertisement

Create a line break in the text inside span

I am using the following HTML in the application:-

<span style="display:inline-block;white-space: pre-line">I would like to discuss this: {"incidentId":"TG00040","desc":"Patient Details","reportdetails":"Patient Name:Bhawana n Grade:10th n Teacher:Meeta"}</span>

But am not able to create line breaks in the text. I have also tried using n,r and br tag but nothing seems to break. The expected output is:-

I would like to discuss this: {“incidentId”:”TG00040″,”desc”:”Patient Details”,”reportdetails”:”Patient Name:Bhawana
Grade:10th
Teacher:Meeta”}

Advertisement

Answer

use <br> instead of n. Do you want output like this with a line break?

<span style="display:inline-block;white-space: pre-line">I would like to discuss this: {"incidentId":"TG00040","desc":"Patient Details","reportdetails":"Patient Name:Bhawana <br> Grade:10th <br> Teacher:Meeta"}</span>
Advertisement