This translation from: How the make the I CAN Bootstrap All the Columns at The Same, height?
I'm using Bootstrap. I am using Bootstrap. How can I make three columns all the same height? How to make the same height three pillars?
Here is a screenshot of the problem. This is a screenshot of the problem. I would like the blue and red columns to be the same height as the yellow column. I hope the same height red and blue and yellow row of columns.
Here is the code: This is the code:
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/> <div class="container-fluid"> <div class="row"> <div class="col-xs-4 panel" style="background-color: red"> some content </div> <div class="col-xs-4 panel" style="background-color: yellow"> catz <img width="100" height="100" src="https://lorempixel.com/100/100/cats/"> </div> <div class="col-xs-4 panel" style="background-color: blue"> some more content </div> </div> </div>
#1st Floor
Reference: https://stackoom.com/question/1Kdlw/ how the Bootstrap columns have the same height
#2nd Floor
Solution 4 using Bootstrap 4 using Bootstrap Solution 4 of 4
There flexbox SO 4 uses Bootstrap's need for Extra CSS. Bootstrap using 4 Flexbox, and therefore require additional CSS.
<div class="container">
<div class="row ">
<div class="col-md-4" style="background-color: red">
some content
</div>
<div class="col-md-4" style="background-color: yellow">
catz
<img width="100" height="100" src="https://lorempixel.com/100/100/cats/">
</div>
<div class="col-md-4" style="background-color: green">
some more content
</div>
</div>
</div>
Solution 1 using negative margins (does not break responsiveness) Solution 1 Use negative margins (not undermine responsiveness)
.row{
overflow: hidden;
}
[class*="col-"]{
margin-bottom: -99999px;
padding-bottom: 99999px;
}
Solution 2 using table Solution 2 Table
.row {
display: table;
}
[class*="col-"] {
float: none;
display: table-cell;
vertical-align: top;
}
3 a using Flex Solution added. Posted August 2015. Comments to the before the this do not the Apply the this Solution. Using Flex 3 solution was added in August 2015. This comment is not posted before for this solution.
.row {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
flex-wrap: wrap;
}
.row > [class*='col-'] {
display: flex;
flex-direction: column;
}
#3rd floor
You only show one row so your use case may be limited to just that. You show only one line, so you may be limited to this use case. Multiple rows you have have the Just, the this plugin in Case - GitHub Javascript-Grids -! Works Perfectly in case you have multiple lines, this plug -github Javascript-grids- can work perfectly! It makes each panel expand to the tallest panel, giving each row potentially a different height based on the tallest panel in that row. It can be extended so that each panel to the top panel, so that the line based on the highest panel for each row provide different heights. It's a jquery solution vs. css, but wanted to recommend it as an alternative approach. Compared with CSS, this is a jquery solution, but would recommend it as an alternative.
#4th floor
The Just the Add that the I'd by Thought at The answer GIVEN by Dr.Flink Also CAN BE A Bootstrap 3 Applied to form-horizontal
Block -. Which CAN BE Very Handy IF you want to use the Cell background Colors for the each thought I just add that, Dr.Flink to the answer can also be applied Bootstrap 3 form-horizontal
Blocks - If you want to use a background color for each cell, it will be very convenient. In order for this to work for bootstrap forms, you would need to wrap the form contents which just serves to replicate a table-like structure. Similar to make it suitable to form the guide, you will need to form the packaging content, which is only used for replication structure of the table.
The example below also provides the CSS which demonstrates an additional media query allows Bootstrap 3 to simply takeover and do it's normal thing on the smaller screen (s). The following example also provides the CSS, the CSS demonstrates an additional media inquiries, the query so Bootstrap 3 can simply take over and normally on a smaller screen. This also works in IE8 +. This also applies in IE8 +.
Example: Example:
<form class="form-horizontal" role="form">
<div class="form-wrapper">
<div class="form-group">
<label class="col-xs-12 col-sm-2 control-label">My Label</label>
<div class="col-xs-12 col-sm-10">
Some content
</div>
</div>
</div>
</form>
.form-wrapper {
display: table;
}
.form-wrapper .form-group {
display: table-row;
}
.form-wrapper .form-group .control-label {
display: table-cell;
float: none;
}
.form-wrapper .form-group label + div {
display: table-cell;
float: none;
}
@media (max-width: 768px) {
.form-wrapper {
display: inherit;
}
.form-wrapper .form-group {
display: block;
}
.form-wrapper .form-group .control-label {
display: inherit;
}
.form-wrapper .form-group label + div {
display: inherit;
}
}
#5th Floor
Update 2018 Update 2018
Approach for Bootstap 3.x Best - the using the CSS of flexbox (The requires minimal and the CSS) .. The best way of Bootstap 3.x - using the CSS of flexbox (and requires minimal CSS).
.equal {
display: flex;
display: -webkit-flex;
flex-wrap: wrap;
}
Same height of flexbox Example Bootstrap flexbox example of the same height Bootstrap
To only apply the same height flexbox at specific breakpoints (responsive), use a media query. To apply the same height only in specific breakpoint of flexbox (response), use the media queries. Example the For, here Wallpaper IS sm
(768px) and up: for example, it is sm
(768px) and above:
@media (min-width: 768px) {
.row.equal {
display: flex;
flex-wrap: wrap;
}
}
This solution also works well for multiple rows (column wrapping): This solution is also applicable to multiple rows (column packing):
https://www.bootply.com/gCEXzPMehZ https://www.bootply.com/gCEXzPMehZ
Other workarounds Other workarounds
Options by Recommended by Will BE THESE Others, But are not A Good IDEA for responsive Design. These options will recommend other people, but for responsive design is not a good idea . These only work for simple single row layouts w / o column wrapping. These are only applicable to simple single-line without changing the layout of the column line.
. 1) the Using Huge negative padding & margins . 1) using a huge negative margins and padding
2) the Using Run the display: the Table-the Cell (Also the this Solution at The Effects responsive Grid, SO CAN BE A @media Query Used to only the Apply table
Run the display ON WIDER Screens the before the Columns at The Stack Vertically) 2) Use Run the display: the Table-the Cell (this solution also affect the response grid so @media query can only be used prior applications listed vertically stacked on a larger screen table
display)
4 on Bootstrap boot program 4
Used by default now IS Flexbox in Bootstrap 4 SO there IS NO need for CSS at The Extra height equal is to the make the Columns: http://www.codeply.com/go/IJYRI4LPwU the case of the Flexbox Bootstrap 4 now in default, so No additional CSS to create high columns: HTTP : //www.codeply.com/go/IJYRI4LPwU
Example: Example:
<div class="container">
<div class="row">
<div class="col-md-6"></div>
<div class="col-md-6"></div>
</div>
</div>
#6th floor
You can use inline-flex as well which works pretty good and may be a little cleaner than modifying every row element with CSS. You can also use inline-flex, the effect is very good, and possibly modify each row element more concise than using CSS .
For my project I wanted every row who 's child elements had borders to be the same height so the borders would look jagged. For my project, I hope the border child elements of each row have the same height, to make the border appear to stagger missing. For this I created a simple css class . To this end, I created a simple CSS classes.
.row.borders{
display: inline-flex;
width: 100%;
}