Browser: Firefox v35 OS: Linux Ubuntu 14, Polymer: v1.4
Was following Rob Dodson's polycasts - most of the videos mention using 'flex' (flexbox) to achieve responsive designs. I however have had a rough time getting it to work..
In the sample file listed below,
- the flex attribute on the paper-header-panel is superflous (even without it, the element stretches - note the blue border
- the flex attribute on the span tag within the toolbar DOES work - see the more icon scoot all the way to the right. This is good / expected
- Finally I'd like the div with the content class to 'flex' - but it won't. Ideally there should be no white area.
The documentation & guide isn't helping a bit. Even the snippets on the guide are not working for me.
Code follows:
<!DOCTYPE html>
<html>
<head>
<script src="bower_components/webcomponentsjs/webcomponents-lite.js"></script>
<link rel='import' href='elements.html' />
<link rel="stylesheet" href="app.css" />
<style>
.icon-snooze {
color: red;
width: 48px;
height: 48px;
}
</style>
<style is="custom-style" include='iron-flex iron-positioning'>
body {
border: 1px dashed red;
}
paper-header-panel {
border: 2px dashed dodgerblue;
}
.content {
border: 2px dashed tomato;
background-color: var(--paper-light-blue-500);
}
</style>
</head>
<body class='fullbleed vertical layout'>
<paper-header-panel class='flex'>
<paper-toolbar>
<paper-icon-button id="navicon" icon="icons:menu"></paper-icon-button>
<div>Header</div>
<span class='flex'></span>
<paper-icon-button id='morebutton' icon='icons:more-vert'></paper-icon-button>
</paper-toolbar>
<div class='content flex'>Content </div>
</paper-header-panel>
</body>
</html>
More observations:
Horizontal flex works as expected/out of the box.
For the vertical flex, it works if I set an explicit height on the parent/container - which kinda defeats the purpose.
<body class='fullbleed vertical layout'>
<div class='layout vertical container' style='height:50vh;' >
<div>one</div>
<div class="flex">two (won't flex without height set)</div>
<div>three</div>
</div>
<div class='layout horizontal container'>
<div>one</div>
<div class="flex">two (will flex)</div>
<div>three</div>
</div>
</div>
iron-flex-layout
uses the/deep/
combinator which is being deprecated. You should use the mixins iniron-flex-layout.html
instead – Alan Dávalosdom-module
-based layout classes. – Gishuiron-flex-layout-classes.html
found in theiron-flex-layout
github root is the correct file to use. – Snekwiron-flex-layout-classes.html
file was still using the old classes model but as you mentioned it's not doing so – Alan Dávalos