How jQuery makes two div have the same height
This article mainly introduces how jQuery makes the two div of the same height, with a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand.
Make the two div have the same height
Sometimes you need to make the two div have the same height no matter what they contain:
$('.div') .css ('min-height', $(' .main-div') .height ())
Set min-height, which means that it can be larger than the main div but definitely not smaller than the main div. However, a more flexible approach is to iterate through a set of elements and then set the height to the height of the highest element:
Var $columns = $('.column'); var height = 0 positive columns.each (function () {if ($(this). Height () > height) {height = $(this). Height ();}); $columns.height (height)
If you want all columns to be the same height:
Var $rows = $('.same-height-columns'); $rows.each (function () {$(this). Find (' .column'). Height ($(this). Height ();}). Thank you for reading this article carefully. I hope the article "how to make the two div height the same height" shared by the editor will be helpful to everyone. At the same time, I also hope you can support us, pay attention to the industry information channel, and more related knowledge is waiting for you to learn!