Summary: I have three main divs within the body tag of my website, the first two have one element of fixed dimension. I want the third div to take up 90% the remaining width and to be centered.
Detail: I have a website that has three main divs within the body tag. The divs, and relevant details, are as follows:
- nav-top: should span the full width of the page, stay in place when scrolling (position: sticky), and be 50px in height
- nav-left: should span the full height of the page (offset by 50px to sit below #nav-top), be 50px wide, and stay in the same place at all times (position: fixed)
- body-content: should have its entire box-model contained within the remaining space left by #nav-top and #nav-left. Of this remaining space, it should take up 90% of the width and be centered horizontally
The #body-content is the div I'm having issues with, the box-model is starting from the edge of window, effectively underneath #nav-left.
I feel this should be a fairly simple problem to solve, but I'm struggling to get it working as expected. There WILL need to be responsive elements for this website, but for now I can't even get this issue resolved.
* {
padding: 0;
margin: 0;
}
#nav-top {
position: sticky;
top: 0;
z-index: 1;
height: 50px;
margin-bottom: 20px;
background-color: DodgerBlue;
}
#nav-left {
position: fixed;
top: 50px;
width: 50px;
height: 100%;
background-color: Silver;
}
#body-content {
background-color: Tomato;
color: white;
width: 90%;
margin: auto;
}
<div id="nav-left">
</div>
<div id="nav-top">
</div>
<div id="body-content">
<div id="breadcrumb">You are here: Home</div>
<div class="jumbotron">
<h1>Software v2</h1>
<p class="lead">Software v2 is the new version of the site!</p>
</div>
<div class="content-row">
<div class="col-33">
<h2>Fun!</h2>
<p>Improved for more fun!</p>
</div>
<div class="col-33">
<h2>Challenging!</h2>
<p>Improved to be more challenging!</p>
</div>
<div class="col-33">
<h2>Share it!</h2>
<p>New features to share your best moments!</p>
</div>
</div>
<hr>
<footer>
<p class="copyright">2019</p>
</footer>
</div>
JS Fiddle: https://jsfiddle.net/ubizvi/bq1zcp7v/19/