Here I'm using bootstrap class for the sticky top
header.
header.js
<header className="header sticky-top">HEADER</header>
stylesheet
header {
overflow: hidden;
padding: 20px 10px;
display: inline-flex;
width: 100%;
height: fit-content;
background-color: blue;
}
body {
margin: 0;
height: 100vh;
overflow:auto;
scroll-behavior: smooth;
}
This is what I wanted to achive.
______________________
|_______header_______|
| |*|
| Container Div |*|
| |*|
| |*|
| |*|
| |*|
| |*|
----------------------
* = scrollbar
This is the example project to work on demo code sandbox
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.