HTML textarea 切断开始的新行
HTML textarea cuts off beginning new lines
HTML 文本区域在新行 ("\n") 在 文本区域中的任何其他内容之后,无论是是否有空格或制表符 ("\t") 之类的空白字符。
但是,当文本区域内容以新行开始时(例如“\ntest”),该新行在显示时会被截断。
关于导致 this/how 补救的原因有什么想法吗?
这似乎是 spec.
A single newline may be placed immediately after the start tag of pre
and textarea
elements. If the element's contents are intended to start with a newline, two consecutive newlines thus need to be included by the author.
请注意,过去在各种浏览器中存在一些关于在元素中引导新行的错误:
HTML 文本区域在新行 ("\n") 在 文本区域中的任何其他内容之后,无论是是否有空格或制表符 ("\t") 之类的空白字符。
但是,当文本区域内容以新行开始时(例如“\ntest”),该新行在显示时会被截断。
关于导致 this/how 补救的原因有什么想法吗?
这似乎是 spec.
A single newline may be placed immediately after the start tag of
pre
andtextarea
elements. If the element's contents are intended to start with a newline, two consecutive newlines thus need to be included by the author.
请注意,过去在各种浏览器中存在一些关于在元素中引导新行的错误: