Skip to content

Instantly share code, notes, and snippets.

@dei79 dei79/demo.html
Created Oct 27, 2012

What would you like to do?
Ensure two div-elements will get the same height (jquery solution)
<script src="" type="text/javascript"></script>
$(function() {
// get the max height of the two divs
var $maxHeight = Math.max($('#left').height(),$('#right').height())
// get the lower div
var $lowerpanel = $('#left')
if ($lowerpanel.height() > $('#right').height())
$lowerpanel = $('#right')
// set the height of the lower panel
#id {
float: left;
#left {
float: left;
width: 50%;
background-color: red;
#right {
float: left;
width: 50%;
background-color: yellow;
<div id="container">
<div id="left">
The left page
<div id="right">
The right page
with more content

This comment has been minimized.

Copy link

commented Sep 5, 2018

how do we get the higher panel instead of lower panel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.