0

Okay, so I have read through probably every answer to this and similar questions on this site and multiple others, but nothing seems to be working. I have a basic web page that has a map on it. I have been tasked with making the map full screen within the browser window, NOT full screen on the computer screen. Below is the snippet of code I am working with. I have my width set to 100% and that's working fine. I tried having my height set to 100% as well, but the map disappears off the page when that happens. I also tried setting the height to auto, but that gives me the same result as height 100%. Any suggestions on how this can be fixed?

<style>
    #map {
        width: 100%;
        min-height: 100%;
</style>

5 Answers5

0

Try to put this style to the container div, not the map itself.

<div class="container">
  map here
</div>

<style>
    .container {
        width: 100%;
        min-height: 100%;
</style>
Guim
  • 628
  • 2
  • 12
  • 26
0

You should try define height value for map tag. For exaple: Your map code in iframe tags, you should define height value for iframe tag.

0
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Set DIV Height to 100% Using CSS</title>
<style type="text/css">
    html, body {
        height: 100%;
        margin: 0px;
    }
    .container {
        height: 100%;
        background: red;
    }
</style>
</head>
<body>
    <div class="container">The height of this DIV element is equal to the 100% height of its parent element's height.</div>
</body>
</html>
0

For making a container consume the entire screen, I prefer using

.container {
    height: 100vh;
}
0

height: 100% means element take all height of its parent container. Generally, you should use:

body, html {
 height: 100%;
}

.container {
  height: 100%;
}
IP_
  • 676
  • 5
  • 18