最簡單的mvc框架中html文件中引入css文件,在瀏覽器地址欄輸入localhost:8080/content/index,其中的href值中的".",瀏覽器解析為GET http://localhost:8080/content/layui/css/layui.css 404 (Not Found)
如何讓瀏覽器解析.的時(shí)候忽略content
6 回答

慕容3067478
TA貢獻(xiàn)1773條經(jīng)驗(yàn) 獲得超3個(gè)贊
開發(fā)中,盡量要避免相對(duì)路徑。
建議使用這種方式
<link rel="stylesheet" href="/layui/css/layui.css">
- 6 回答
- 0 關(guān)注
- 1812 瀏覽
添加回答
舉報(bào)
0/150
提交
取消