The HTML below is copied from a simple example contrived to replicate problems in correctly filling 100% of the height from areas in a containing main view (app page) by children custom elements nested within those spaces. (The application uses the dart-polymer packages downloaded by pub.) The container is implemented using Polymer's layout attributes (flex model). A simple custom element (text content) is nested in the #left div element. A more complicated custom element that uses the W3C Grid Layout is nested in the #right div element. The four rectangles in #right are properly rendered and colored, except that the height of my-gridcontent overflows the space.
[Edit: The screenshot is what I am seeing, not what I want. I want my-simplecontent to overlay #left and my-gridcontent to overlay #right. There should be no scrollbars.]
Devtools shows heights of #left and #right with 562px, my-simplecontent with 18px, and my-gridcontent with 626px. The widths of the nested components fill their respective spaces as expected. I've tried the { display:block; height: 100% } rule with various elements without success.
Related: cannot get height 100% to work in polymer elements.
Dart SDK: 1.7.2. Dartium: 37.0.2062.120 (292122)
pubspec.yaml
dependencies:
# Dart Polymer and essential libraries
polymer: ">=0.15.0 <0.16.0"
core_elements: ">=0.3.1 <0.4.0"
paper_elements: ">=0.4.0 <0.5.0"
web_components: ">=0.7.0 <0.8.0"
index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My App</title>
<!-- include the web_components polyfills with support for Dart. -->
<script src="packages/web_components/platform.js"></script>
<script src="packages/web_components/dart_support.js"></script>
<link rel="import" href="packages/core_elements/core_icons.html">
<link rel="import" href="packages/polymer/polymer.html">
<link rel="import" href="packages/core_elements/core_toolbar.html">
<link rel="import" href="packages/paper_elements/paper_icon_button.html">
</head>
<body unresolved fullbleed>
<polymer-element name="my-app" noscript vertical layout>
<template>
<style type="text/css">
:host { width: 100%; height: 100%; }
div#left { background: lightyellow; }
div#right { background: lightblue; }
</style>
<core-toolbar id="appToolbar">
<paper-icon-button id="navmenu" icon="menu"></paper-icon-button>
<div flex>App</div>
<paper-icon-button id="morebutton" icon="more-vert"></paper-icon-button>
</core-toolbar>
<div horizontal layout flex>
<div id="left" flex>
<my-simplecontent id="simple"></my-simplecontent>
</div>
<div id="right" flex>
<my-gridcontent id="grid"></my-gridcontent>
</div>
</div>
</template>
</polymer-element>
<polymer-element name="my-simplecontent" noscript>
<template>
<style type="text/css">
:host { display: block; height: 100%; background: lightcoral; }
</style>
Simple content
</template>
</polymer-element>
<polymer-element name="my-gridcontent" noscript>
<template>
<style type="text/css">
:host {
display: grid; height: 100%;
grid-template-columns: 1fr 1fr;
grid-template-rows: 1fr 1fr;
}
#a { grid-column: 1; grid-row: 1; }
#b { grid-column: 2; grid-row: 1; }
#c { grid-column: 1; grid-row: 2; }
#d { grid-column: 2; grid-row: 2; }
div { height: 100%; }
.red { background: red; }
.blue { background: blue; }
.green { background: green; }
.yellow { background: yellow; }
</style>
<div id="a" class="red">A</div>
<div id="b" class="blue">B</div>
<div id="c" class="green">C</div>
<div id="d" class="yellow">D</div>
</template>
</polymer-element>
<my-app></my-app>
<!-- bootstrap polymer -->
<script type="application/dart">export 'package:polymer/init.dart';</script>
<script src="packages/browser/dart.js"></script>
</body>
</html>
Version 38.0.2125.0 (292384) (64-bit)
and ChromeVersion 38.0.2125.104 (64-bit)
). – Günter Zöchbauer