使用 Thymeleaf,如何使图像充当超链接?
Thymeleaf Documentation没有提及图像,我尝试使用标准 HTML 来解决此问题,但以下尝试均未使我的图像成为事件超链接。
<a th:href="@{/user/myUser}">
<img src="../../static/images/image.jpg" alt="logo"/>
</a>
<a href="https://www.w3schools.com">
<img src="../../static/images/image.jpg" alt="logo"/>
</a>
最佳答案
<a href="/oauth2/authorization/google">
<img alt="Google Login" title="Google login"
th:src="@{/images/login-with-google.png}" />
</a>
关于image - Thymeleaf - 充当超链接的图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49513515/