I'm building web dashboard for my app. It loads dynamically different modules and puts them inside Bootstrap container. These modules can have variable height and when the browser window is narrow enough, they stack vertically. That's what I wanted.
The problem is with the higher resolutions. I'd like to stack them in 3 columns, so I put every panel inside <div class="col-sm-4">
It works great if we have 3 panels only. With fourth, we get something like this:
I've searched for other approaches and found one that suggested removing <div class="col-sm-4">
so I did it with poor result:
The only working way was to manually add panels to one of the columns.
That produced intended result, but needs more JS logic to operate. I need to count how many panels do I have and choose proper column. Is this the only way to go or did I miss something? Thanks!
EDITED - of course I've forgot to include code.
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
</head>
<body>
<div class="container">
<div class="page-header">
<h1>Stack test</h1>
<p class="lead"></p>
</div>
<!--<div class="row">-->
<div class="col-sm-4">
<div id="panel_control_manual" class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Panel 1</h3>
</div>
<div class="panel-body">
I miss panel 4 so much :(
</div>
</div>
</div>
<div class="col-sm-4">
<div id="panel_control_manual" class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Panel 2</h3>
</div>
<div class="panel-body">
Panel content
</div>
</div>
</div>
<div class="col-sm-4">
<div id="panel_control_manual" class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Panel 3</h3>
</div>
<div class="panel-body">
Such panel. Much content. Wow.
<br/><br/><br/><br/><br/><br/><br/>
<br/><br/><br/><br/><br/><br/><br/>
<br/><br/><br/><br/><br/><br/><br/>
End of long content.
</div>
</div>
</div>
<div class="col-sm-4">
<div id="panel_control_manual" class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Panel 4</h3>
</div>
<div class="panel-body">
I don't want to have that much space above me!
</div>
</div>
</div>
</div> <!-- /container -->
</body>
</html>