In HTML5, placeholder is a very useful property that can replace the hint function of a UI control when there is no content in the control, without having to write extra code. But if there is a textarea control, we need to use "\ n" When we want multiple lines of text hint information, "
"Can not achieve the line-wrapping function, later in an inadvertent operation, the implementation of the placeholder line-wrapping function.
The placeholder property value itself contains formatting information, but cannot escape characters (such as ' \ n ', ' \ t ') and can be used directly in the editor to implement the placeholder line-wrapping function. Such as:
<textarea placeholder="If you were a teardrop;In my eye,
For fear of losing you,I would never cry.
And if the golden sun,Should cease to shine its light, \t\n
Just one smile from you,Would make my whole world bright."></textarea>
The display results are as follows:
Test environment: Google Chrome, Version 40.0.2214.91 (64-bit)
How the placeholder property of HTML5 implements line wrapping