回答編集履歴

1

コードを追加

2021/08/17 11:12

投稿

IT001
IT001

スコア620

test CHANGED
@@ -2,4 +2,18 @@
2
2
 
3
3
  例えば、相対パス(```css/style.css```)だと、http://localhost:8080/sub/から読み込むと、読み込むファイルが```http://localhost:8080/sub/css/style.css```になります。
4
4
 
5
+ 絶対パスにしたい場合は、先頭に"/"を入力ください。
6
+
7
+
8
+
9
+ ```html
10
+
11
+ <link rel="stylesheet" href="/css/style.css">
12
+
13
+
14
+
15
+ <!-- Thymeleafの場合 -->
16
+
5
- 絶対パス(```/css/style.css```)で指定すると、```http://localhost:8080/css/style.css```になります。
17
+ <link rel="stylesheet" th:href="@{/css/style.css}">
18
+
19
+ ```