我的固定位置标题下的部分与标题稍微重叠,而不是与标题齐平。轮播的顶部应直接位于标题的底部下方,以使其充满整个屏幕减去标题尺寸。
html由正文中的3个,一个粘贴的页眉和一个不会移动的页脚组成。
body{
scroll-snap-type: y mandatory;
overflow-y: scroll;
}
.header{
position: sticky;
top: 0;
background-color: #0d0d0d;
height: 65px
}
section {
position: relative;
height: calc(100vh - 65px);
scroll-snap-align: center;
}
.splash-carousel{
height: calc(100vh - 65px);
width: 100%;
}
答案 0 :(得分:0)
固定顶部从内容的正常流中删除nav
。及其所取代的部分。您需要将margin-top
中的section
设置为padding-top
或将56px
的正文设置为section
,以使56px
变得完全可见。
Bootstrap-4导航仪的原始高度为 body {
padding-top: 56px;
}
。无论如何,您都应该自行查找并计算。
body {
padding-top: 56px;
}
.full-screen {
height: calc(100vh - 56px) !important;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet"/>
<body>
<nav class="navbar navbar-expand-lg navbar-light bg-light fixed-top">
<a class="navbar-brand" href="#">Navbar</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Dropdown
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#">Something else here</a>
</div>
</li>
<li class="nav-item">
<a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Disabled</a>
</li>
</ul>
<form class="form-inline my-2 my-lg-0">
<input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search">
<button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
</form>
</div>
</nav>
<main class="container-fluid ">
<div class="row">
<div class="col bg-primary full-screen">
</div>
</div>
</main>
</body>
65px
https://codepen.io/anon/pen/ZdMjMX
如您所见,它在码本中有效。如果它对您不起作用,则问题是标题的高度大于let myStr = "10010001";
let result = [];
myStr.replace(/(?=(1[0]+1))/g, (text, match) => {
result.push(match);
return text;
});
console.log(result);
或图像太大。尝试不使用图像,看看是否是原因。