# 路徑問題 ###### tags: `Java Web-Servlet`  <font color="red">紅字:相對路徑</font> ../../css/login.css <font color="blue">藍字:絕對路徑</font> http://locahost:8080/pr010/css/index.css (IP地址:端口號/contextroot/css/index.css)  ```htmlmixed= <!-- ../css:回到此檔案的上一級(user),並且在到同級別的css資料夾 --> <!--相對路徑 --> <link href="../css/login.css" rel="stylesheet"> ```  ### 為了容易理解,盡量使用"絕對路徑" ====================================== <base href="http://localhost:8080/pr010/"/> 的作用是讓當前頁面的路徑都以這個為基礎 <link href="css/shoppong.css"> 就等於<link href="http://localhost:8080/pr010/css/shoppong.css"> ### 可以用thymeleaf應用 th:href="@{}" @{}等同於<base href="http://localhost:8080/pr010/"/> 因此<link th:href="@{/css/shoppong.css}"> 相當於<link href="http://localhost:8080/pr010/css/shoppong.css">
×
Sign in
Email
Password
Forgot password
or
Sign in via Google
Sign in via Facebook
Sign in via X(Twitter)
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
Continue with a different method
New to HackMD?
Sign up
By signing in, you agree to our
terms of service
.