将 index.html 发布到 GitHub 页面

时间:2020-12-31 23:32:58

标签: html git github-pages

当我将基本 HTML 文件上传到 GitHub 页面时,当我尝试访问 GitHub 页面时收到 404。

我注意到这是因为我的代码中的元素之间有一个额外的空间。如果我删除多余的空间,问题就解决了,我可以在没有 404 的情况下访问 GitHub 页面。有人可以解释为什么会发生这种情况吗?

以下是不在 <p> 元素之间有空格的 git 页面上运行的代码:

<html>
    <head>
        <title>
            Sharpen your pencil trivia
        </title>
    </head>
    <body>
        <p>
            How long a line can you draw with the typical pencil?
        </p>  

        <p>
            <img src="http://wickedlysmart.com/hfhtmlcss/trivia/pencil.png"
            alt="The typical new pencil can draw a line 35 miles long. ">
        </p>
    </body>
</html>

以下是在

元素之间没有空格的情况下运行的内容:

<html>
    <head>
        <title>
            Sharpen your pencil trivia
        </title>
    </head>
    <body>
        <p>
            How long a line can you draw with the typical pencil?
        </p>
        <p>
            <img src="http://wickedlysmart.com/hfhtmlcss/trivia/pencil.png"
            alt="The typical new pencil can draw a line 35 miles long. ">
        </p>
    </body>
</html>

此外,一旦我删除元素之间的空格,运行网站,再次添加导致 404 的空格,并成功运行网站后,实际上不起作用的版本。

0 个答案:

没有答案
相关问题