Bootstrap 3 Panel 100% height inside column

Jaka Konda

I have simple 3 column layout with bootstrap. Each column inside has a panel. My is goal that each panel has 100% height of it's parent and that all of the columns are same height (solved using display: flex). I tried with display table and relative/absolute positioning but nothing came up with desired result. I'd like to avoid fixed values e.g. height: 300px etc.

Thanks!

.row-eq-height {
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
}
/* Doesn't work */
/*
    .col-sm-4 {
        position: relative;
    }

    .panel-default {
        height: 100%;
        position: absolute;
    }
*/
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />

<div class="container">
  <div class="row row-eq-height">
    <div class="col-sm-4" style="background: red">
      <div class="panel panel-default">
        <div class="panel-body">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi tristique gravida ligula. Aliquam erat volutpat. Fusce quam erat, porttitor ac ante sed, tempus fringilla nisl. Phasellus sit amet orci volutpat, hendrerit metus vitae, dapibus nunc.
          Phasellus eros mauris, iaculis quis massa vel, dictum sagittis mauris. Donec egestas sem venenatis vehicula facilisis. Mauris in ultrices augue. Etiam eros libero, malesuada nec luctus quis, aliquam nec massa. Fusce vitae hendrerit nibh, eget
          hendrerit mauris. Aliquam quis sem ipsum. Phasellus aliquet rhoncus tellus ac imperdiet. Sed nec lacus at erat elementum efficitur vel in magna. Vestibulum ac enim id ligula iaculis ultricies at facilisis lorem. Nullam lobortis ultrices felis</div>
      </div>
    </div>
    <div class="col-sm-4" style="background: green">
      <div class="panel panel-default">
        <div class="panel-body">Col 2</div>
      </div>
    </div>
    <div class="col-sm-4" style="background: blue">
      <div class="panel panel-default">
        <div class="panel-body">Nullam nec ex metus. Curabitur mollis sem vitae augue ultrices ornare. Phasellus efficitur viverra turpis, nec scelerisque purus rutrum vel. Ut pellentesque congue tincidunt. Nulla et nulla velit. Quisque pellentesque mi ac metus faucibus pretium.
          Duis sit amet vestibulum dolor.
          </div>
        </div>
      </div>
    </div>
  </div>

Shehary

This can solve the problem and avoid using fixed values e.g. height: 300px.

.row-eq-height, .row-eq-height > div[class*='col-'] {
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    flex:1 1 auto;
}
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<div class="container">
<div class="row row-eq-height">
<div class="col-sm-4" style="background: red">
  <div class="panel panel-default">
	<div class="panel-body">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi tristique gravida ligula. Aliquam erat volutpat. Fusce quam erat, porttitor ac ante sed, tempus fringilla nisl. Phasellus sit amet orci volutpat, hendrerit metus vitae, dapibus nunc.
	  Phasellus eros mauris, iaculis quis massa vel, dictum sagittis mauris. Donec egestas sem venenatis vehicula facilisis. Mauris in ultrices augue. Etiam eros libero, malesuada nec luctus quis, aliquam nec massa. Fusce vitae hendrerit nibh, eget
	  hendrerit mauris. Aliquam quis sem ipsum. Phasellus aliquet rhoncus tellus ac imperdiet. Sed nec lacus at erat elementum efficitur vel in magna. Vestibulum ac enim id ligula iaculis ultricies at facilisis lorem. Nullam lobortis ultrices felis</div>
  </div>
</div>
<div class="col-sm-4" style="background: green">
  <div class="panel panel-default">
	<div class="panel-body">Col 2</div>
  </div>
</div>
<div class="col-sm-4" style="background: blue">
  <div class="panel panel-default">
	<div class="panel-body">Nullam nec ex metus. Curabitur mollis sem vitae augue ultrices ornare. Phasellus efficitur viverra turpis, nec scelerisque purus rutrum vel. Ut pellentesque congue tincidunt. Nulla et nulla velit. Quisque pellentesque mi ac metus faucibus pretium.
	  Duis sit amet vestibulum dolor.
	  </div>
	</div>
  </div>
</div>
</div>

Fiddle

Side Note: Flex has limited browser support especially on mobile devices.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Bootstrap 3 - 100% height of custom div inside column

From Dev

Bootstrap 3 side panel 100% height of parent

From Dev

Bootstrap's 3.x Panel with 100% height

From Dev

Bootstrap's 3.x Panel with 100% height

From Dev

Bootstrap panel height 100% over size

From Dev

Fullscreen panel bootstrap with highcharts (100% height)

From Dev

bootstrap panel header not 100% inside scrollable div

From Dev

Full Height, fluid 100% width and height, 2 column Bootstrap 3 layout with header

From Dev

Bootstrap 3 - Full Height Side Panel

From Dev

Bootstrap - Responsive Row and Column with 100% height

From Dev

Bootstrap 3 - Aligning column height

From Dev

Bootstrap 3 Table inside a panel overflowing

From Java

How to make bootstrap column height to 100% row height?

From Dev

How to set a Textarea to 100% height in Bootstrap 3?

From Dev

How to make a 100% height container in Bootstrap 3

From Dev

Bootstrap 3: How to affix after 100% height

From Dev

Bootstrap 3: sidebar 100% height always on screen

From Dev

Bootstrap 3: How to affix after 100% height

From Dev

Bootstrap - make the images inside the column with the same height?

From Dev

Responsive image height inside Bootstrap column

From Dev

Bootstrap 3 - Button height match panel (CSS3)

From Dev

Bootstrap: How to get a column with 100% the height of another column

From Dev

Bootstrap panel inside a column class going beyond that class

From Dev

How do we create a 100% height column in Twitter Bootstrap?

From Dev

Mobile Safari and Bootstrap 4 column content height 100% not honored

From Dev

Same height column bootstrap 3 row responsive

From Dev

Same height column bootstrap 3 row responsive

From Dev

Bootstrap columns inside panel

From Dev

Bootstrap: 100% height footer

Related Related

  1. 1

    Bootstrap 3 - 100% height of custom div inside column

  2. 2

    Bootstrap 3 side panel 100% height of parent

  3. 3

    Bootstrap's 3.x Panel with 100% height

  4. 4

    Bootstrap's 3.x Panel with 100% height

  5. 5

    Bootstrap panel height 100% over size

  6. 6

    Fullscreen panel bootstrap with highcharts (100% height)

  7. 7

    bootstrap panel header not 100% inside scrollable div

  8. 8

    Full Height, fluid 100% width and height, 2 column Bootstrap 3 layout with header

  9. 9

    Bootstrap 3 - Full Height Side Panel

  10. 10

    Bootstrap - Responsive Row and Column with 100% height

  11. 11

    Bootstrap 3 - Aligning column height

  12. 12

    Bootstrap 3 Table inside a panel overflowing

  13. 13

    How to make bootstrap column height to 100% row height?

  14. 14

    How to set a Textarea to 100% height in Bootstrap 3?

  15. 15

    How to make a 100% height container in Bootstrap 3

  16. 16

    Bootstrap 3: How to affix after 100% height

  17. 17

    Bootstrap 3: sidebar 100% height always on screen

  18. 18

    Bootstrap 3: How to affix after 100% height

  19. 19

    Bootstrap - make the images inside the column with the same height?

  20. 20

    Responsive image height inside Bootstrap column

  21. 21

    Bootstrap 3 - Button height match panel (CSS3)

  22. 22

    Bootstrap: How to get a column with 100% the height of another column

  23. 23

    Bootstrap panel inside a column class going beyond that class

  24. 24

    How do we create a 100% height column in Twitter Bootstrap?

  25. 25

    Mobile Safari and Bootstrap 4 column content height 100% not honored

  26. 26

    Same height column bootstrap 3 row responsive

  27. 27

    Same height column bootstrap 3 row responsive

  28. 28

    Bootstrap columns inside panel

  29. 29

    Bootstrap: 100% height footer

HotTag

Archive