空格<code> and back to line

时间:2018-05-28 18:40:31

标签: css textarea whitespace

My javascript enable to "write" in <code> (without content editable property, behind there is a hidden <textarea> and javascript catch keyboard events...) and while i'm writing in this hidden <textarea>, text goes in line and a horizontal scroll bar appear : enter image description here I want to prevent this and make text back to line (like default <textarea> behaviour).

I've tried to add in my css the property white-space : pre-wrap; but I got this : enter image description here (textarea visible with red text color, to compare <textarea> behaviour and my <code>'s)

How to fix this and make my <code> behave like a <textarea> ? Thanks for answers :)

0 个答案:

没有答案