Currently I’m working on a small web application with the requirement to bring the height of two side-by-side div elements on the same level. The content of this two elements are different and the width depends on the browser window. This means the div content floats in the elements and the height depends on the height of the inner content. I tried to find a working solution based on CSS only. At the end I want to share a jquery based solution which works well for me
- The following markup can be found in many web apps
https://gist.github.com/3965331/77a38858b214ae71c2cf521fa3ee0c0048e1bca8 - First I added jquery and code to identify the div with the maximum height. After that this height will be set at the second div element as well
https://gist.github.com/3965331/1fbbfbbd2a3116ad48ed03f874695d9bfb4d7589 - Finally moving out the code into a separate function helps to reuse this code in other apps as well. It could als be a good idea to build a small jquery plugin
https://gist.github.com/3965331/81308dec45be018cd4f29220460ee6f770fa5005