In Opera, Explorer and Firefox, the height specified in percent is not perceived!

What to do if you need to set the height in percent?

Website with a problem: https://invest-apartments.ru .

Closed due to the fact that off-topic by participants AK , pavel , tutankhamun , Yuri , Denis Bubnov Jan 17 '17 at 13:00 .

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:

  • “Questions asking for help with debugging (“ why does this code not work? ”) Should include the desired behavior, a specific problem or error, and a minimum code for playing it right in the question . Questions without an explicit description of the problem are useless for other visitors. See How to create minimal, self-sufficient and reproducible example . " - AK, pavel, tutankhamun, Yuri, Denis Bubnov
If the question can be reformulated according to the rules set out in the certificate , edit it .

  • four
    Sadly And what shall we do about it? - Deonis
  • Or calculate the desired height using JavaScript. - Svyatoslav
  • Deonis, the opera does not perceive the height in percent! - Nikitakuz
  • one
    invest-apartments.ru is my website. Problem Explorer, Opera, Firefox. The height of the upper and lower blocks equal to 50% of the screen does not work in the browsers listed above. - Nikitakuz
  • Here it is not necessary to throw a link to the site, you need to provide in the text of the question code. Minimum required to reproduce the problem. - AK

3 answers 3

In order for the height to work in Explorer, Opera and Firefox need all blocks in which your block is wrapped to register a height value of 100% . And at body try to register height of 100% .

And, by the way, in order to avoid white indentation around the edges of the body page, specify more attributes margin:0; padding: 0; margin:0; padding: 0;

    1. Find in your html a closing tag </ center>. He's not there.
    2. Anyway, to use this tag, practically, as the second most important "wrapper" is something. By the way, in html5 it is worthily forgotten.
    3. You have good helpers - they are validators: both html and css

    From all seen, the conclusion suggests itself that you have just begun to take the first steps in this direction. Go through to start the html basics and css .

      Set the height in vh (viewport height) - the units that specify the height in percent of the screen height.

      To your unit occupied 50% of the height of the screen, set it height: 50vh; .