sukhvir
sukhvir

Reputation: 5575

Changing the height of an element to match the size of another element

Please see: http://jsfiddle.net/E4Zgj/227/

  1. How can I change the height of left, and right based on the height of middle (which is dynamic and can change) using HTML and CSS?

  2. If 1 is not possible then, how can I change the height of left, and right to cover the whole visible screen using HTML, and CSS?

Upvotes: 0

Views: 54

Answers (2)

Alex Mason
Alex Mason

Reputation: 76

Granted that this question is not tagged with javascript or specifically jQuery. If you were able to load jQuery you can match the height of the middle element easily.

var middleHeight = $('.middle').height();
$('.left, .right').height(middleHeight);

Upvotes: 0

CodeShark
CodeShark

Reputation: 1741

Question 1 can't be done without Javascript.

Question 2 can be done with using

position:absolute;
min-height:100%;
height:100%;

The height:100%; is optional but without position:absolute; it won't work. If you set position:absolute; you have to set left:80%; for your right side because otherwise it overlaps your left side.

Upvotes: 1

Related Questions