Select to view content in your preferred language

Height of MapView Container div collapses with HTML5 declaration

1281
5
Jump to solution
02-28-2018 07:55 AM
LA
by
Emerging Contributor

Hi,

The height of the div that contains my MapView collapses to zero if I add the HTML5 DOCTYPE declaration, <!DOCTYPE html>, but it has the correct height if I don't have the HTML5 DOCTYPE declaration. This happens both in IE 11 and Chrome. When I look at the developer tools in each browser, the only change I notice when the DOM is rendered is the following:

With HTML5 DOCTYPE:

In Chrome

<!DOCTYPE html>
<html class="dj_webkit dj_chrome dj_contentbox"><head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
‍‍‍‍

In IE 11

<html class="dj_trident dj_trident7 dj_contentbox">
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">

Without HTML5 DOCTYPE: 

In Chrome

<html class="dj_quirks dj_webkit dj_chrome dj_contentbox"><head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">

In IE 11

<html class="dj_quirks dj_trident dj_trident7 dj_contentbox"><head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">

Some of my code is here, viewmap is the MapView container div.

<style>
body {
 font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
 min-height: 100%;
 margin: 0px;
 background-color: rgb(230, 247, 255);
 }
#viewMap {
 padding: 0;
 height: 35%;
 width: 100%;
 }‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

Why is this happening? I would like to set my document to HTML5 but not have the map div collapse to zero height. Thanks,

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

LA,

  Just add this css rule to the very top of your style section (no need to change any other css rules you have):

    html,
    body,
    #viewDiv {
      padding: 0;
      margin: 0;
      height: 100%;
      width: 100%;
    }

View solution in original post

0 Kudos
5 Replies
RobertScheitlin__GISP
MVP Emeritus

LA,

  Can you put together a quick sample that demos your problem? I use <!DOCTYPE html> all the time without any issue.

0 Kudos
LA
by
Emerging Contributor

Hi Robert,

I'm attaching my sample code without <!DOCTYPE html>, you can add it in the first line to see how the page renders differently.

Thanks,

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

LA,

  Just add this css rule to the very top of your style section (no need to change any other css rules you have):

    html,
    body,
    #viewDiv {
      padding: 0;
      margin: 0;
      height: 100%;
      width: 100%;
    }
0 Kudos
LA
by
Emerging Contributor

That made it work correctly, thank you, Robert.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Don't forget to mark this question as answered by clicking on the "Mark Correct" link on the reply that answered your question.

0 Kudos