NZED NZED - 4 days ago 6
CSS Question

Linking CSS to HTML view using Thymeleaf

Good morning, good evening, good night,

A noob question here, i'm using Thymeleaf as a template engine, and linking Bootstrap CSS sheet doesn't seem to work, here is my strucuture

resources

-static

--css

---bootstrap.min.css

-templates

--view.html

and line of code

< link rel="stylsheet" type="text/css" href="../static/css/bootstrap.min.css" th:href="@{../css/bootstrap.min.css}"/>


Edited: I do get the plaintext .css file when i open the link in the href,
And the
.table-striped
attribute i'm using in my table class does exist in the CSS file.

<table class="table table-striped">


Thank you for your feedback

Answer

Got it finally .. it was the URLs, this is what worked for me, /static is handled by default i guess so removed it from the url and its "twerkin".

Structure
-static
--css
---bootstrap.min.css
-templates
--view.html

CSS Link
th:href="@{/css/bootstrap.min.css}

Comments