第一次在 GitHub 上上傳我正在為我的課程做的專案。在 VSCode 中作業時一切正常,但在上傳到 GitHub 并添加到 GitHub 頁面后,嘗試使用主頁圖示導航回來時出現 404 錯誤。我怎樣才能解決這個問題??
<body>
<a href="docs/index.html">
<svg xmlns="http://www.w3.org/2000/svg" width="50" height="50" fill="rgb(254, 232, 194)" id="house" viewBox="0 0 16 16">
<path d="M8 6.982C9.664 5.309 13.825 8.236 8 12 2.175 8.236 6.336 5.309 8 6.982Z"/>
<path d="M8.707 1.5a1 1 0 0 0-1.414 0L.646 8.146a.5.5 0 0 0 .708.707L2 8.207V13.5A1.5 1.5 0 0 0 3.5 15h9a1.5 1.5 0 0 0 1.5-1.5V8.207l.646.646a.5.5 0 0 0 .708-.707L13 5.793V2.5a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 0-.5.5v1.293L8.707 1.5ZM13 7.207V13.5a.5.5 0 0 1-.5.5h-9a.5.5 0 0 1-.5-.5V7.207l5-5 5 5Z"/></svg>
</a>
這是我在 VSCode 中使用的當前代碼。
我正在考慮從 GitHub Pages 中復制鏈接,但不確定是否可行。
第一個專案對此非常困惑,希望得到一些反饋。
uj5u.com熱心網友回復:
GitHub Pages 中的 URL 結構是否與您在 VS Code 中使用的結構相匹配?根據您提供的代碼,您似乎正在鏈接到 VS Code 中名為“docs”的子檔案夾中的索引頁面。
<a href="docs/index.html">
那么,查看您的 GitHub Pages 站點結構,該索引檔案是位于專案目錄的根目錄下,還是仍在“docs”檔案夾中?
如果它在“檔案”中,例如:https ://yourusername.github.io/docs/然后嘗試以下鏈接:
<a href="/docs/">
或者,如果它位于根級別,例如:https ://yourusername.github.io/那么您可以嘗試以下鏈接:
<a href="/">
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/537404.html
下一篇:css背景影像不顯示影像的底部
