📜  html 文本内容换行 - Html 代码示例

📅  最后修改于: 2022-03-11 14:53:06.378000             🧑  作者: Mango

代码示例2
//setting this css style solving problem with new line in textContent
h1.setAttribute('style', 'white-space: pre;');

//add \r\n in text everywhere You want for line-break (new line)
h1.textContent = "this is line one  \r\n and this is line 2";