How to get two divs the same height depending on which one has the bigger height in CSS [duplicate]

Tags: css,html

Problem :

This question already has an answer here:

I have a two divs inside a container div, and I want the img_box div to match the height of the content_con div depending on how much height it has. So let it stay if the content_con div has three paragraphs and that gives content_con a height of 303 pixels; I want the img_box div to match that height. Make sense? How do I do that in CSS?

In short, img_box and content_con match the height depending on which one has the bigger height. See below to see a vis:

<div class="box_container">
  <div class="img_box"></div>
  <div class="content_con"><div>

   .img_box  |  .content_con

Solution :

You can do like this by the following method, no matter how much data comes in the div. But the height will be equal for both divs.

.box_container{display:table;width:100% }
.img_box, .content_con{display:table-cell; vertical-align:top; width:50%}

Here is a demo to see how it looks:

    CSS Howto..

    How to make all borders the same color?

    Whats a good way to show large background images on css

    How to refactor an existing project to use Compass?

    How do I fix this simple CSS floating issue in IE?

    How do I make numbered paragraphs (HTML5/CSS3)

    Show overlay fullscreen div then hide it by clicking on it

    Image, src, href in same span. How to locate? Webdriver, css locator

    CSS: how to make a span only as wide as its content

    How to make dynamic slideshow using php, mysql, css and html?

    How to keep an unordered list centered within the screen?

    How to make div expand all the way to the right

    How to override external css marked as !important? [closed]

    CSS how to revert SVG animation on mouseout from current frame

    How to create change image option on mousehover like in gmail account?

    If I have 3 elements, how do I only allow one to be highlighted when clicked at any one time? - CSS, jQuery

    How to center an unordered list?

    How to set link visited color in JQuery

    How do I fit text into footer margins

    How to use more times css transform property?

    CSS: How do I stretch a background with a different z-index to height of page contents

    how to let -ms-grid adaptive width layout in win8 html and javascript metro app?

    how to scale img by percentage of self and not percentage of its container

    How do you make a sticky nav bar change colour when you scroll to a desired div?

    how to display php search engine execution time and number of results before the results

    Rotation of a div gives a black background on IE, how can I remove it?

    How to apply a single line of CSS to an external iframe?

    How to place two section elements next to each other using CSS? [duplicate]

    How to show parts of sprite with CSS keyframes to create animation?

    How can I display an alert with the position of the element that was clicked?

    How does a document reference an SCSS file?