Currently, I am in the process of constructing a web dashboard for my application. This dashboard is designed to dynamically load various modules and place them within a Bootstrap container. These modules have varying heights and will stack vertically when the browser window is narrow enough, which aligns with my desired outcome.
However, an issue arises when dealing with higher resolutions. Ideally, I would like these modules to be arranged in three columns; therefore, I enclosed each panel within <div class="col-sm-4">
. This method works perfectly with just three panels. Yet, upon adding a fourth panel, the layout distorts as depicted below:
https://i.sstatic.net/oTUK4.png
In search of alternative solutions, I came across one suggestion recommending the removal of <div class="col-sm-4">
, so I attempted this but encountered poor results:
https://i.sstatic.net/QShDd.png
The only successful approach involved manually assigning panels to a specific column, resulting in the intended layout, yet requiring additional JavaScript logic to function effectively. This manual process entails counting the number of panels and selecting the appropriate column. Is there an alternative method that I may have overlooked? Thank you!
EDITED - it seems I forgot to include the code snippet.
<!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-lq8mTJOASx81Au+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/>
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>