HTML識別 string 里的 '\n' 並成功換行顯示
設置標簽的的css屬性
white-space: pre-line;
<div style='white-space: pre-line;'>
string <--!這里的數據可以是后台也可以是變量字符串而不是直接a\nb-->
</div>
white-space: pre-line;
<div style='white-space: pre-line;'>
string <--!這里的數據可以是后台也可以是變量字符串而不是直接a\nb-->
</div>
本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。