Line break inside HTML tag attribute value

给你一囗甜甜゛ 提交于 2020-01-12 13:55:14

问题


How can I insert line breaks inside HTML attribute values, like this:

<href="mailto:info@example.com?subject=TestMail&body=Please enter the following details.
Name
Email
Mob No">

When the user replies, the body part should display as below:

Please enter the following details.
1. Name
2. Email
3. Mob No

I tried using <br> tags, but they get displayed.


回答1:


The line break should be URL encoded into %0D%0A

Your mailto will look like:

    <a href="mailto:xxx@example.com?subject&body=1.Name%0D%0A2.Email">mailme</a>

Info from http://www.cubetoon.com/2008/how-to-enter-line-break-into-mailto-body-command/



来源:https://stackoverflow.com/questions/10502256/line-break-inside-html-tag-attribute-value

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!