How to set a relative height of a div with no height

I need help setting ‘div1’ to 50% of its parent element: ‘div2’. The height of ‘div2’ is decided by an image inside it. How can I set ‘div1’ to 50% ‘div2’

Example: http://jsfiddle.net/k39048eh/

For ‘div1’ I have tried: height: 50%, min-height: 50%;
For ‘div2’ I have tried: height: auto


Source: javascript

Leave a Reply