小编sam*_*rma的帖子

图像在固定标题上可见

我创建了一个标题,position: fixed在下面我用图像替换添加了一个标识.但是,当我向下滚动时,图像会标题上移动而不是标题移动.

如何让固定标题始终位于顶部(即强制图像在其下移动)?

这是我的代码的一部分:

HTML

<header>
    <nav>
        <ul>
            <li>Home</li>
            <li>About</li>
            <li>Work</li>
        </ul>
    </nav>
</header>

<div class="banner">
    <h1><img src="imgs\logo.png" />Jackle</h1>
    <h3>We design and create.</h3>
</div>

<img src="" class="representationBannerPic">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Veritatis recusandae ullam dolores sint eligendi voluptatibus incidunt esse vero totam aspernatur. Iste quae molestias sed enim corrupti rerum nam culpa asperiores.</p>
Run Code Online (Sandbox Code Playgroud)

CSS

header
{
    background-color: black;
    width: 100%;
    height: 47px;
    color: white;
    position: fixed;
}
.banner …
Run Code Online (Sandbox Code Playgroud)

html css

2
推荐指数
1
解决办法
1万
查看次数

标签 统计

css ×1

html ×1