网站的Github页面上未显示背景图片 [英] Background Images not showing on Github Pages for Website

查看:214
本文介绍了网站的Github页面上未显示背景图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经查看了有关此问题的Stack Overflow上的其他一些线程,但是由于某些原因,它们似乎无法正常工作.我检查了诸如图像的路径目录之类的东西,并且我认为这是正确的. 这是我在github页面上的网站回购的链接: https://github.com/lawrencecheng123 /lawrencecheng123.github.io

I've looked at some other threads on Stack Overflow regarding this problem, but for some reason they don't seem to be working. I've checked things like the path directory for the image, and I think that it's correct. Here's a link to my repo for the website on github pages: https://github.com/lawrencecheng123/lawrencecheng123.github.io

我的存储库中有一个"Seattle.jpg"图像,我试图将其设置为网站首页的背景,索引"第81行的"fstPage"类引用了该图像. html"文件和存储库中"index.css"文件的第321行.

In my repo there is a "Seattle.jpg" image that I'm trying to set as the background of the first page of my website, which is referenced by the "fstPage" class on line 81 of the "index.html" file and line 321 of the "index.css" file in the repo.

谢谢您的帮助!

推荐答案

由于文件命名错误,此操作失败.在index.css内部,您想使用一个名为Seattle.JPG的文件.

It fails because you named your file wrong. Inside of your index.css, you wanted to use a file named Seattle.JPG.

您的文件名为Seattle.jpg.固定结尾并添加https://.

Your file is named Seattle.jpg. Fix the ending and add https://.

以下是正确的链接:https://lawrencecheng123.github.io/Seattle.jpg

完整的CSS:

.fstPage {
    background-image:url("https://lawrencecheng123.github.io/Seattle.jpg");
    /*background-color: lightgray;*/
    height: 700px;
    width:100%;
    background-size:cover;
}


工作片段:


Working snippet:

.fstPage  {
    background-image:url("https://lawrencecheng123.github.io/Seattle.jpg");
    /*background-color: lightgray;*/
    height: 700px;
    width:100%;
    background-size:cover;
}

<div class="fstPage"></div>

这篇关于网站的Github页面上未显示背景图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆