我项目的问题。在我的CSS文件上获得404

发布于 2025-01-18 23:32:05 字数 975 浏览 2 评论 0原文

在我的HTML中,我

<link href ="project.css" rel ="stylesheet">
<style>
   body, html {
   height: 100%;
   margin: 0;
   }
</style>
<title>Page1</title>
</head>
<body>
   <div class="bg"></div>
</body>

在CSS中写道:

 .bg {
    /* The image used is edited from original World Table Tennis logo */
     background-image: url("WTT.jpeg");
    /* Full height */
     height: 100%;
    /* Center and scale the image nicely */
     background-position: center;
     background-repeat: no-repeat;
     background-size: cover;
}

但是,我不确定如何将上传到VS代码的图像插入页面中,这就是为什么我使用CSS的原因。不幸的是,当我使用烧瓶运行时,我将获得get/project.css http/1.0“ 404

我最初在我的html页面上有my.bg,但我收到<代码> get/wtt.jpeg http/1.1“ 404 。因此,我将其移至CSS文件。几个月来我还没有做过诅咒,所以我有点迷路了,尤其是在使用图像时。 文件结构

In my HTML, I wrote

<link href ="project.css" rel ="stylesheet">
<style>
   body, html {
   height: 100%;
   margin: 0;
   }
</style>
<title>Page1</title>
</head>
<body>
   <div class="bg"></div>
</body>

In my CSS, I wrote:

 .bg {
    /* The image used is edited from original World Table Tennis logo */
     background-image: url("WTT.jpeg");
    /* Full height */
     height: 100%;
    /* Center and scale the image nicely */
     background-position: center;
     background-repeat: no-repeat;
     background-size: cover;
}

However, I'm not sure how to insert the image that I uploaded to my VS Code into my page, which is why I used CSS. Unfortunately, when I use Flask run, I get GET /project.css HTTP/1.0" 404.

I originally had my.bg on my HTML page, but I received GET /WTT.jpeg HTTP/1.1" 404. So I moved it to my CSS file. I haven't done the curse in a couple of months, so I'm a bit lost, especially when using images.
file structure

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

誰認得朕 2025-01-25 23:32:06

之前
href ="project.css" rel ="stylesheet"

之后
href="project.css" rel="stylesheet"

去掉两边空格并检查

Befor
href ="project.css" rel ="stylesheet"

After
href="project.css" rel="stylesheet"

remove spaces on both sides and check

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文