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

Is there a way to make a container have the styles width: 100% – constant

I have a vertical nav-bar that takes that is a set 250px. I made the nav-bar a template on django and now I am looking to create a container div that fills the rest of the page. My question is how do I get this div to be the width of the entire page minus this nav-bar.

>Solution :

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

I would do it with grid. Set two columns, one 250px and give the second rest of space.

body{
  margin:0;
}

.grid{
display: grid;
grid-template-columns: 250px 1fr;
height: 100vh;
width: 100vw;
}

.nav {
 width:250px;
 background-color: green;
}

.content {
  width: 100%;
 background-color: blue;
}
<div class="grid">
  <div class="nav"></div>
  <div class="content"></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