html5 – How to divide the total size of a html page into two divs at any resolution?


My question is:

How I can be divided into two div the total size of an HTML page in any resolution?

That is, a div that occupies 50% of the height of the page and another that occupies the other 50% that remains.

This so that my containers (divs) are always occupying the entire height of the page (50 and 50%).


Using percentages you could do something like this:

html, body{
  height: 100%;
  background-color: #000;

  height: 49%;
  background-color: #6A737C;
  margin: 1% 1%;
<!DOCTYPE html>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
  <div class="contenedor">
  <div class="contenedor">

I hope it helps you.

Scroll to Top