What would be the correct way to build a srcset
-attribute with Thymeleaf
using the standart url syntax @{/...}
?
Example:
<img th:src="@{/i/1000.jpg}" srcset="/i/1500.jpg 1500w, /i/2000.jpg 2000w" />
Nevermind, it was easier than expected and logical at the same time:
<img
th:src="@{/i/1000.jpg}"
th:attr="srcset=@{/i/1500.jpg} + ' 1500w, ' + @{/i/2000.jpg} + ' 2000w'"
/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With