如何用图标替换HTML电子邮件链接

时间:2018-10-18 06:58:05

标签: html css twitter-bootstrap-3 google-api bootstrap-4

您好,我创建了一个电子邮件链接,在该链接上创建了主题,消息正文和收件人,用户只需单击“发送”。我遵循了this教程,并且工作正常。以下是代码。

string table = "<tr><td style=\"font-size:12px;\"><td style=\"font-size:12px;\"><a href=\"mailto:recpient@gmail.com?subject=Request to star github repository&body=Hi All, %0D%0DIt is highly appreciated if you could star the following repository.%0D%0DSincerely,%0DHR Admin.\">recpient@gmail.com</a></td>"

请注意,我将其作为字符串返回,因此需要转义“

但是现在我想用电子邮件图标替换电子邮件链接,以使其看起来更加用户友好。

我将其添加到标题中。

<link rel=\"stylesheet\" href=\"http://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css\">

并如下更新a标签。

<a href=\"mailto:recever@gmail.com?subject=Request to star github repository&body=Hi All, %0D%0DIt is highly appreciated if you could star the following repository.%0D%0DSincerely,%0DHR Admin.\"><i class=\"material-icons\"></i></a>

但是我没有收到电子邮件图标。当我检查html时,它还有一些其他数字。

<i class="m_-6876977088503419915material-icons"></i>

当我删除“ m_-6876977088503419915”时,出现该图标。出现这种现象的任何原因以及如何纠正?我还尝试在标签内定义按钮类,但仍然无济于事。

1 个答案:

答案 0 :(得分:0)

添加此CDN

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">

请替换代码

<a href=\"mailto:recever@gmail.com?subject=Request to star github repository&body=Hi All, %0D%0DIt is highly appreciated if you could star the following repository.%0D%0DSincerely,%0DHR Admin.\"><i class=\"material-icons\"></i></a>

通过

<a href="mailto:recever@gmail.com?subject=Request to star github repository&body=Hi All, %0D%0DIt is highly appreciated if you could star the following repository.%0D%0DSincerely,%0DHR Admin."><i class="fa fa-envelope"></i></a>