首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >将Github页面背景图像更改为无

将Github页面背景图像更改为无
EN

Stack Overflow用户
提问于 2022-06-09 06:22:44
回答 1查看 72关注 0票数 0

这是我的Github存储库:https://github.com/Yicheng-1218/OceanCrisis

我有一个问题,为什么标题中的样式会自动更改为无?

我使用main.css将标题的背景图像更改为其他图像,但它不起作用。

index.html:

代码语言:javascript
运行
复制
<div id="header">

            <!-- Inner -->
            <div class="inner">
                <header>
                    <h1><a href="index.html" id="logo">OceanCrisis</a></h1>
                    <hr>
                    <p>海洋危機</p>
                </header>
                <footer>
                    <a href="#main" class="button circled scrolly">閱讀</a>
                </footer>
            </div>

            <!-- Nav -->
            <nav id="nav">
                <ul>
                    <li style="white-space: nowrap;"><a href="index.html">首頁</a></li>
                    <li style="white-space: nowrap;"><a href="#banner" class="scrolly">公益活動</a></li>
                    <li style="white-space: nowrap;"><a href="#features" class="scrolly">生態危機</a></li>
                    <li style="white-space: nowrap;"><a href="#footer" class="scrolly">關於</a></li>
                </ul>
            </nav>

        </div>

这是github页面显示的:

代码语言:javascript
运行
复制
<div id="header" bis_skin_checked="1" style="background-image: none;">

            <!-- Inner -->
            <div class="inner" bis_skin_checked="1">
                <header>
                    <h1><a href="index.html" id="logo" bis_skin_checked="1">OceanCrisis</a></h1>
                    <hr>
                    <p>海洋危機</p>
                </header>
                <footer>
                    <a href="#main" class="button circled scrolly" bis_skin_checked="1">閱讀</a>
                </footer>
            </div>

            <!-- Nav -->
            <nav id="nav">
                <ul>
                    <li style="white-space: nowrap;"><a href="index.html" bis_skin_checked="1">首頁</a></li>
                    <li style="white-space: nowrap;"><a href="#banner" class="scrolly" bis_skin_checked="1">公益活動</a></li>
                    <li style="white-space: nowrap;"><a href="#features" class="scrolly" bis_skin_checked="1">生態危機</a></li>
                    <li style="white-space: nowrap;"><a href="#footer" class="scrolly" bis_skin_checked="1">關於</a></li>
                </ul>
            </nav>

        </div>

main.css

代码语言:javascript
运行
复制
/* Header */

#header {
    position: relative;
    background-image: url("../images/114645.jpg");
    background-size: cover;
    background-position: center center;
    background-attachment: fixed;
    color: #fff;
    text-align: center;
    padding: 7.5em 0 2em 0;
    cursor: default;
}
EN

回答 1

Stack Overflow用户

发布于 2022-06-09 06:50:46

代码语言:javascript
运行
复制
#header {
    position: relative;
    background-image: url("./static/images/114645.jpg");
    background-size: cover;
    background-position: center center;
    background-attachment: fixed;
    color: #fff;
    text-align: center;
    padding: 7.5em 0 2em 0;
    cursor: default;
}

or

代码语言:javascript
运行
复制
#header {
    position: relative;
    background-image: url("static/images/114645.jpg");
    background-size: cover;
    background-position: center center;
    background-attachment: fixed;
    color: #fff;
    text-align: center;
    padding: 7.5em 0 2em 0;
    cursor: default;
}

你的directory structure:-

代码语言:javascript
运行
复制
project > static >
        |        |- > css > main.css
        |        |        |- other css file
        |        |- > images > 114645.jpg
        |                    |- etc. images
        |
        |- index.html
        |- etc. file

如果您想要访问而不是使用static/images/114645.jpg./static/images/114645.jpg",则

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72555564

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档