Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to layout workspace with CSS

I’ve created the following diagram of how i would like my UI to look:
UI

but i just can’t get it to behave the way I want to using css.

I’ve tried to build it with CSS Grids, but instead of overflowing it’s expanding beyond the max-width.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

How would I do i contrain the app to 100vh or what other approaches would work?

>Solution :

CSS-Grid is what you want here. Just specify the grid-container height as 100vh

* {
  margin: 0;
  padding: 0;
  min-width: 0;
  min-height: 0;
  box-sizing: border-box;
}

 ::before,
 ::after {
  box-sizing: inherit;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-auto-rows: auto auto 1fr 1fr;
  height: 100vh;
  text-align: center;
  gap: .25em;
}

.nav {
  grid-column: 1 / span 2;
  background: lightblue;
  padding: 1em;
}

main {
  grid-row: 2 / span 3;
  background: green;
}

.controls {
  background: lightgrey;
  padding: .5em;
}

.scroll {
  overflow: auto;
  border: 1px solid green;
}

.h {
  height: 500px;
  background: linear-gradient(red, blue);
}
<div class="grid">
  <div class="nav">Navbar</div>
  <main>Main</main>
  <div class="controls">Controls</div>
  <div class="scroll">
    <div class="h"></div>
  </div>
  <div class="scroll">
    <div class="h"></div>
  </div>
</div>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading