Reputation: 6027
I have 2 unrelated elements: #A
and #B
(in terms of hierarchy). #A
does not have a predefined height. I would like #B
to end up being the height of #A
minus 325px
.
I know Sass can handle operations, but I am unsure of how to query the height of #A
- is that even possible?
Upvotes: 2
Views: 292
Reputation: 23883
Not possible with CSS or SASS, plain easy with jQuery:
$('#b').outerHeight( $('#a').outerHeight() - 325 );
Demo: http://jsbin.com/ulimon/2/edit
Upvotes: 1
Reputation: 11271
Sorry, but I think is not possible to get a element height with SASS (i'm not an expert in sass, but I couldn't find any option).
I recommend you to do this with JavaScript:
window.onload = fixHeight();
function fixHeight() {
var divh = document.getElementById('leftdiv').offsetHeight;
var divhnum = new Number(divh);
var setheight = (divhnum - 325);
document.getElementById('rightdiv').style.height = setheight + 'px';
}
Hope this will help you!
Upvotes: 1