Thymeleaf 文档中所需的字体未显示 [英] Desired font in Thymeleaf document is not shown

查看:43
本文介绍了Thymeleaf 文档中所需的字体未显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Thymeleaf 模板生成 HTML 页面,然后将其用作电子邮件的内容.所需的字体系列是 Calibri.然而,当生成 HTML 文档(然后作为电子邮件发送)时,检索到的包含此文档的电子邮件不包含 Calibri 中的字体.但是,如果我删除与 Thymeleaf 相关的元素并在浏览器中将页面作为普通 HTML 页面启动,它会在 Calibri 中显示内容.有谁知道问题可能出在哪里?提前致谢!

I am using a Thymeleaf template for generating an HTML page that is then used as the content of an email. The desired font family is Calibri. When the HTML document is generated however (and then sent as an email) the retrieved email containing this document doesn't contain the font in Calibri. If I remove the Thymeleaf-related elements and launch the page as a normal HTML page in the browser, however, it does show the content in Calibri. Does anyone know where the problem may be? Thanks in advance!

<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
      <title></title>
      <link href='http://fonts.googleapis.com/css?family=Calibri'
      rel='stylesheet' type='text/css' />
      <style>
         body {
            font-family: 'Calibri', serif;
            font-size: 11pt;
         }
     </style>

  </head>
  <body>
    <p style="line-height:25pt;">
        We from <span th:text="${nameCompany}"></span> are sending you an email.
   </p>

 </body>
</html>

推荐答案

你能否尝试更改这行代码并告诉我这是否有帮助

can you try changing this line of code and tell me if this helped

改变

<link href='http://fonts.googleapis.com/css?family=Calibri'
      rel='stylesheet' type='text/css' />

  <link th:href="@{http://fonts.googleapis.com/css?family=Calibri}"
          rel='stylesheet' type='text/css' />

这篇关于Thymeleaf 文档中所需的字体未显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆