can sombody help me ? The div (the last one) inside the sidebar sould be scrollable. I wanna use the sidebar for some functions like phonenumber search and displaying birthdays.
In the last div I wanna show a lot of notifications. min-height of each notification is about 100px. If there are too many i wanna make the div scrollable.
Thats my code sofar:
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
.navbar {
position: fixed;
top: 0;
left: 0;
right: 0;
height: 36px;
background-color: red;
border: 4px solid blue;
}
.sidebar {
position: fixed;
top: 36px;
bottom: 0;
right: 0px;
width: 200px;
background-color: blue;
border: 4px solid yellow;
}
.sidebar_item {
margin-bottom: 5px;
}
.item_header {
font-weight: bold;
border: 1px solid #000;
background-color: green;
}
.content {
margin-top: 36px;
margin-right: 200px;
background-color: yellow;
border: 4px solid purple;
}
<div class="navbar">Navbar</div>
<div class="sidebar">
<div class="sidebar_item">
<div class="item_header">Header</div>
Content
</div>
<div class="sidebar_item">
<div class="item_header">Header</div>
Content
</div>
<div class="sidebar_item">
<div class="item_header">Header</div>
Content
</div>
<div class="sidebar_item">
<div class="item_header">Header</div>
Content
</div>
<div class="sidebar_item">
<div class="item_header">Header</div>
Content
</div>
<!-- Scrollable div -->
<div class="sidebar_item">
<div class="item_header">Header</div>
<p>TOP</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>BOTTOM</p>
</div>
</div>
<div class="content">
<p>TOP</p>
<p>bla</p>
<p>bla</p>
<p>bla</p>
<p>bla</p>
<p>bla</p>
<p>bla</p>
<p>bla</p>
<p>bla</p>
<p>bla</p>
<p>bla</p>
<p>bla</p>
<p>bla</p>
<p>bla</p>
<p>bla</p>
<p>bla</p>
<p>bla</p>
<p>bla</p>
<p>bla</p>
<p>bla</p>
<p>bla</p>
<p>bla</p>
<p>bla</p>
<p>bla</p>
<p>bla</p>
<p>bla</p>
<p>bla</p>
<p>bla</p>
<p>bla</p>
<p>BOTTOM</p>
</div>
Used
.sidebar_item:last-child
Pseudo-class selector for that and calculate the height usingcalc()
Working Demo