Published
Edited
Feb 17, 2021
Also listed in…
HTML Elements
Insert cell
Insert cell
Insert cell
{
let divs = ''
for(let i = 0; i< 100; i++){
divs += `<div> some element </div>`
}
let output = html`
<div class="outer">
<header class="header-outer">
<div class="header-inner">
<div class="header-logo">[header-logo]</div>
<nav class="header-navigation">[header-navigation]</nav>
</div>
</header>

${divs}
</div>
<style>
.outer{
overflow:scroll;
height: 200px;
}

.header-outer {
display: flex;
align-items: center;
position: sticky;
height: 120px;

background-color: tan;
border: 1px solid black;
}

.header-inner {
height: 70px;
position: sticky;
top: 0;
}

.header-outer {
display: flex;
align-items: center;
position: sticky;
top: -50px; /* Equal to the height difference between header-outer and header-inner */
height: 120px;
}

</style>
`
yield output
}
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more