Update: The polymer docs are now updated to reflect the answer below
I'm doing a polymer 1.0 app.
I'm trying to layout some paper toolbars on part of the screen horizontally.
It seems I can get iron-flex-layout's @apply(--layout-horizontal) to work on some elements but not on others.
I put together a little test below to show whats going on.
The funny thing is that if I copy the contents of the --layout-horizontal style into the tag in chrome dev tools it works. It also works if I just copy the contents of --layout-horizontal into a new style.
Here is the example of whats going on.
The first div is the example from the 0.5 to 1.0 migration guide.
The second div is the example but instead trying to layout a section instead of a span.
The third line is where I explicitly copied and applied the --layout-horizontal style.
<link rel="import" href="../../bower_components/polymer/polymer.html">
<link rel="import" href="../../bower_components/iron-flex-layout/iron-flex-layout.html">
<dom-module id="layout-test">
<style>
/* Example from migration guide */
.header {
@apply(--layout-horizontal --layout-center);
}
/* A hack that makes it work */
.hack {
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-ms-flex-direction: row;
-webkit-flex-direction: row;
flex-direction: row;
}
</style>
<template>
<!-- Working example from migration guide -->
<div class="header">
<img src="https://www.polymer-project.org/images/logos/lockup.svg">
<span class="name">name</span>
</div>
<!-- This example does not work -->
<div class="header">
<img src="https://www.polymer-project.org/images/logos/lockup.svg">
<section class="name">name</section>
</div>
<!-- This hack works fine -->
<div class="hack">
<img src="https://www.polymer-project.org/images/logos/lockup.svg">
<section class="name">name</section>
</div>
</template>
</dom-module>
<script type="text/javascript">
Polymer({
is: 'layout-test'
});
</script>
Full project is available here https://github.com/nburn42/polymer-1.0-LayoutTest
Thanks,
Nathan