用 iron-pages 元素填充页面
Fill page with iron-pages element
我正在尝试用 iron-pages 元素填充整个页面。使用以下代码,我尝试创建一个如下所示的页面:
-------------------------------------
| Top |
-------------------------------------
| Bottom |
| |
| |
| |
| |
| |
-------------------------------------
代码:
<html>
<head>
<script src="bower_components/webcomponentsjs/webcomponents.js"></script>
<link rel="import" href="bower_components/polymer/polymer.html">
<link rel="import" href="bower_components/iron-flex-layout/iron-flex-layout.html">
<link rel="import" href="bower_components/iron-pages/iron-pages.html">
<style is="custom-style">
html,body {
margin: 0;
padding: 0;
height: 100%;
background-color: yellow;
}
div {
border: 2px solid grey;
background-color: white;
margin: 2px;
}
p {
margin: 5px;
}
.outer {
width: 100%;
height: 100%;
@apply(--layout-vertical);
@apply(--layout-flex);
}
.inner {
@apply(--layout-flex);
}
</style>
</head>
<body>
<div class="outer">
<div><p>Top</p></div>
<iron-pages selected="0" class="inner">
<div><p>Bottom</p></div>
</iron-pages>
</div>
</body>
</html>
但是,底部部分未展开以填充可用空间 space。
如果我删除 iron-pages 元素并将内部样式添加到底部 div,我会得到想要的结果。
问题已解决。 iron-pages 元素需要弯曲以获取可用的 space(原样),然后内容也需要弯曲以填充整个区域。
<html>
<head>
<script src="bower_components/webcomponentsjs/webcomponents.js"></script>
<link rel="import" href="bower_components/polymer/polymer.html">
<link rel="import" href="bower_components/iron-flex-layout/iron-flex-layout.html">
<link rel="import" href="bower_components/iron-pages/iron-pages.html">
<style is="custom-style">
html,body {
margin: 0;
padding: 0;
height: 100%;
background-color: yellow;
}
div {
border: 2px solid grey;
background-color: white;
margin: 2px;
}
p {
margin: 5px;
}
.outer {
width: 100%;
height: 100%;
@apply(--layout-vertical);
@apply(--layout-flex);
}
.inner {
@apply(--layout-flex);
@apply(--layout-vertical);
}
.content {
@apply(--layout-flex);
}
</style>
</head>
<body>
<div class="outer">
<div><p>Top</p></div>
<iron-pages selected="0" class="inner">
<div class="content">
<p>Bottom</p>
</div>
</iron-pages>
</div>
</body>
</html>
我正在尝试用 iron-pages 元素填充整个页面。使用以下代码,我尝试创建一个如下所示的页面:
-------------------------------------
| Top |
-------------------------------------
| Bottom |
| |
| |
| |
| |
| |
-------------------------------------
代码:
<html>
<head>
<script src="bower_components/webcomponentsjs/webcomponents.js"></script>
<link rel="import" href="bower_components/polymer/polymer.html">
<link rel="import" href="bower_components/iron-flex-layout/iron-flex-layout.html">
<link rel="import" href="bower_components/iron-pages/iron-pages.html">
<style is="custom-style">
html,body {
margin: 0;
padding: 0;
height: 100%;
background-color: yellow;
}
div {
border: 2px solid grey;
background-color: white;
margin: 2px;
}
p {
margin: 5px;
}
.outer {
width: 100%;
height: 100%;
@apply(--layout-vertical);
@apply(--layout-flex);
}
.inner {
@apply(--layout-flex);
}
</style>
</head>
<body>
<div class="outer">
<div><p>Top</p></div>
<iron-pages selected="0" class="inner">
<div><p>Bottom</p></div>
</iron-pages>
</div>
</body>
</html>
但是,底部部分未展开以填充可用空间 space。
如果我删除 iron-pages 元素并将内部样式添加到底部 div,我会得到想要的结果。
问题已解决。 iron-pages 元素需要弯曲以获取可用的 space(原样),然后内容也需要弯曲以填充整个区域。
<html>
<head>
<script src="bower_components/webcomponentsjs/webcomponents.js"></script>
<link rel="import" href="bower_components/polymer/polymer.html">
<link rel="import" href="bower_components/iron-flex-layout/iron-flex-layout.html">
<link rel="import" href="bower_components/iron-pages/iron-pages.html">
<style is="custom-style">
html,body {
margin: 0;
padding: 0;
height: 100%;
background-color: yellow;
}
div {
border: 2px solid grey;
background-color: white;
margin: 2px;
}
p {
margin: 5px;
}
.outer {
width: 100%;
height: 100%;
@apply(--layout-vertical);
@apply(--layout-flex);
}
.inner {
@apply(--layout-flex);
@apply(--layout-vertical);
}
.content {
@apply(--layout-flex);
}
</style>
</head>
<body>
<div class="outer">
<div><p>Top</p></div>
<iron-pages selected="0" class="inner">
<div class="content">
<p>Bottom</p>
</div>
</iron-pages>
</div>
</body>
</html>