JSFiddle - React, Tailwind, and code Playground
by chiefGui
HTML
<div class="header">
</div>
<div class="site">
<div class="container">
<div class="container-head">
</div>
<div class="container-body">
<div class="right-sidebar">
Just a menu will be right here.
</div>
<div class="left-content">
<ul>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</div>
</div>
</div>
</div>
CSS
body {
font-family: Tahoma
}
.header {
background-color: #49c98e;
width: 100%;
height: 50px;
}
.site {
padding: 1.5em 0;
}
.container {
background-color: #c7c7c7;
width: 95%;
margin: 0 auto;
position: relative;
}
.right-sidebar {
background-color: #a94cd5;
width: 300px;
height: 100%;
position: absolute;
right: 0;
}
.left-content {
background-color: #dbdbdb;
width: 100%;
height: 500px;
overflow-y: scroll;
}
.left-content ul {
padding: 25px 0;
float: left;
}
.left-content ul li {
background-color: #a94cd5;
width: 150px;
height: 100px;
float: left;
margin: 15px;
list-style: none;
}
JavaScript
function calculateResponsiveWidth() {
$realWidth = $(".container").width() - $(".right-sidebar").outerWidth(),
$containerContent = $(".left-content");
$containerContent.css({
"width": $realWidth
});
}
$(window).on("resize", function () {
calculateResponsiveWidth();
});
calculateResponsiveWidth();