JSFiddle - React, Tailwind, and code Playground
by camel2243
HTML
<nav><h2>Nav</h2></nav>
<article>
<section class="left">
<h2>Left</h2>
<div class="content">Left Content</div>
</section>
<section class="right"><h2>Right</h2></section>
</article>
<footer><h2>Footer</h2></footer>
CSS
* {
color: darkslategray;
}
nav {
display: flex;
justify-content: center;
align-items: center;
width: 100%;
background: lightskyblue;
height: 80px;
}
article {
display: flex;
width: 100%;
gap: 12px;
}
.left, .right {
flex-grow: 1;
text-align: center;
min-height: 500px;
background: aliceblue;
margin: 12px 0;
/* scrolling ancestor */
overflow: auto;
}
.content {
background: lightpink;
padding: 24px 0;
margin: 0 10%;
/* sticky content */
position: sticky;
top: 10px;
}
footer {
display: flex;
justify-content: center;
align-items: center;
width: 100%;
background: lightsteelblue;
height: 50px;
}