Skip to content

Instantly share code, notes, and snippets.

@PrestonII
Created October 22, 2020 13:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PrestonII/aa2e3bcd8ab58710a07e81779295645d to your computer and use it in GitHub Desktop.
Save PrestonII/aa2e3bcd8ab58710a07e81779295645d to your computer and use it in GitHub Desktop.
Create A 3 Row Container w/ A Scrollable Middle Row
:root{
font-size: 16px;
box-sizing: border-box;
}
html, body, #root {
width: 100%;
overflow-y: hidden;
height: 100%;
/* min-height: 100vh; */
}
.App {
display: grid;
grid-template-rows: 10rem 1fr 10rem;
height: 100%;
border: 10px solid blue;
}
.element {
border: 1px solid red;
overflow-y: scroll;
}
.child {
height: 10rem;
}
import React from 'react';
import logo from './logo.svg';
import './App.css';
function App() {
return (
<div className="App">
<div className="element">Top</div>
<div className="element">
<div className="child">Get</div>
<div className="child">this</div>
<div className="child">thing</div>
<div className="child">to</div>
<div className="child">work!</div>
</div>
<div className="element">Bottom</div>
</div>
);
}
export default App;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment