我项目的问题。在我的CSS文件上获得404
在我的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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
之前
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