如何在 HTML 属性值中插入换行符,如下所示:
<href="mailto:info@example.com?subject=TestMail&body=Please enter the following details.
Name
Email
Mob No">
当用户回复时,正文部分应显示如下:
Please enter the following details. 1. Name 2. Email 3. Mob No
我尝试使用 <br>
标签,但它们会显示出来。
最佳答案
换行符应该被 URL 编码成 %0D%0A
您的 mailto 看起来像:
<a href="mailto:xxx@example.com?subject&body=1.Name%0D%0A2.Email">mailme</a>
信息来自 http://www.cubetoon.com/2008/how-to-enter-line-break-into-mailto-body-command/
关于html - HTML 标记属性值内的换行符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10502256/