image - Thymeleaf - 充当超链接的图像

标签 image hyperlink thymeleaf

使用 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/

相关文章:

css - 我可以使 div 透明但可点击吗

java - 如何获取 Thymeleaf 模板中环境变量的值?

php - jQuery 按类调整文档上所有图像的大小

php - 使用php将图像重命名为产品id

javascript - 目标 ="_blank"与 window.open

java - 需要更改使用的名称 sec :authentication in thymeleaf

html - Springboot : Displaying pictures on html by using the link out of a database

iphone - 透明颜色在模拟器上有效,但在 iPhone 上变成黑色

python - 遍历图像目录并将它们全部旋转 x 度并保存到目录

android - 我可以创建(如何)指向移动应用程序的单个 html 链接,根据设备将用户发送到 itunes 或 gplay 吗?