Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7935147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T21:50:11+00:00 2026-06-03T21:50:11+00:00

I have a liquid layout and am learning/ using Less.js for my CSS. I

  • 0

I have a liquid layout and am learning/ using Less.js for my CSS.

I have a div ‘A’ that needs to take account of the user viewbox, substract another div ‘B’ height (which is in %) and finally another div ‘C’ which is in pixel.

Here is what I thought would work but doesn’t:

@menubarsHeight: 7%;   // declaring variable with div 'B' 's height.
@ttlHeight: '$(window).height()';     // calculating height using jquery 
@midParentHeight: -20px + @didParentHeight - @menubarsHeight;     // calculating the height based on the above two variables, -20px is the height of div 'C'.     
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T21:50:13+00:00Added an answer on June 3, 2026 at 9:50 pm

    There are a few things unclear here. Namely, you don’t tell us what @didParentHeight is, and you calculate @ttlHeight but don’t use it. Nor do you state explicitly what div B’s parent is (the window?).

    Given these uncertainties, I will assume some things and attempt an answer. If all three div’s have the window as their parent, and your javascript is giving a correct window height, then it seems like this would be the answer:

    @menubarsHeight: 0.07; /* define as decimal */
    @midParentHeight: @ttlHeight - 20px - (@ttlHeight * @menubarsHeight);
    

    I use 0.07 instead of 7% because I’m not quite sure if LESS will do the multiplication correctly using a percentage (it would be mixing px and % units). So with the decimal, then assuming @ttlHeight were 100px, this should calculate to:

    @midParentHeight: 100px - 20px - (100px * 0.07);
    

    Which should become:

    @midParentHeight: 100px - 20px - 7px = 73px
    

    If you need to use the @menubarsHeight to later actually define your div B, then do this (which will take the decimal and put it into a % unit value for css):

    div.B { height: percentage(@menubarsHeight); }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Inside a liquid css layout i have this code: <div class=column> <div class=absolute_small_column><p>Absolut small
Alright I have a CSS liquid div based layout for my personal web site.
Have a liquid layout that has fixed width for left side and elastic right
I have a great working 3 panel liquid layout but I just noticed that
I'd like to have a [Fixed][Liquid][Fixed] cross-browser compatible layout. HTML: body div#col-1 div#col-2 div#col-3
If I have a for loop in Liquid (using Jekyll), how can I target
I have implemented liquid layout for my website. I have set width of body
I have a really stuburn layout, that I just can not resolve .. -
I have a form that is used to record a transaction. Liquid is moved
I have a really, really simple CSS question that has already been asked here

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.