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

Question:

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%).

Answer:

Using percentages you could do something like this:

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

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

I hope it helps you.

Scroll to Top