I need to insert styles in email template (thymeleaf). I need to make a common css files for several templates.
Using spring boot 1.3.3
I tried to follow what's in the following post: Thymeleaf + CSS+SpringBoot
email file: resources > mails > "email.html" css file: resources > static > css > "styles.css"
I use a WebContext for the mail (I used to use a Context but the relative path was not accepted with Context and WebContext was required).
In my css:
h1 {
color: #78ab46;
}
In my template:
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<title > Hello </title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" media="all"
href="../static/css/styles.css" th:href="@{/css/styles.css}" />
</head>
<body>
<h1> Hello </h1>
</body>
The result is that the mail is sent but the css style is not taken into an account. I don't see any error message either.
Could you help me, please?
Thanks,
Manuela