๊ธฐํƒ€

[ thymeleaf ] ์ด๋ฏธ์ง€ ๊ฒฝ๋กœ ๊ฐ€์ ธ์˜ค๊ธฐ

PYT 2022. 1. 5. 15:41
๋ฐ˜์‘ํ˜•

 

ํผ๋ธ” ๋ฐ›์•˜์„ ๋•Œ ์ด๋ ‡๊ฒŒ span tag์— url์ด ์ด๋ ‡๊ฒŒ ๋“ค์–ด๊ฐ€ ์žˆ์—ˆ๋Š”๋ฐ

<span style="background-image: url(../../assets/images/sample-visual01.jpg)"></span>

์ด๋ฏธ์ง€๊ฐ€ ์•ˆ๊ฐ€์ ธ์™€์ ธ์„œ

<span th:style="'background-image:url('+ @{/images/sample-visual01.jpg} +');'"></span>

์ด๋ ‡๊ฒŒ ์ˆ˜์ •ํ•˜๋‹ˆ ๊ฐ€์ง€๊ณ  ์™”๋‹ค....ใ…Ž

 

 

์ฐธ์กฐ : https://stackoverflow.com/questions/35789526/how-to-set-background-url-for-css-files-in-thymeleaf

 

How to set background url for css files in thymeleaf?

I have a thymeleaf template where I don't have CSS files imported and wanted to declare style attribute for the body element with background-image: url{/image.jpg} property with relative image URL. I

stackoverflow.com

 

๋ฐ˜์‘ํ˜•