Set sensitive div height to her sibling

I have two divs whose width is controlled by percent. I want the right div to be exactly the same as the left div, which expands and contracts depending on the width of the displayed image and the width of the browser window.

Is there any way to do this without javascript?

http://jsfiddle.net/5JU2t/

+5
source share
4 answers

The easiest way to do this - to make div .rightabsolutely positioned and set topand bottomon 0.

Remember to place the parent ( .main) div relatively and remove all the floats:

.right {
    bottom:0;
    position: absolute;
    right:0; 
    top: 0;
}

.main {
    position: relative;
}

Working example: http://jsfiddle.net/5JU2t/1/

Note

, , , . , float: left , :

: http://jsfiddle.net/5JU2t/2/

+12

div divs height:auto height: 100%.

0

(.main) (.right, .left) .

0

, css

-6

All Articles