Polymer 1.1- Firefox 'layout vertical center center' broken
Asked Answered
L

0

6

Using Polymer 1.1, in Chrome the elements are centered when the screen is resized smaller. But in Firefox, they shift to the left.

I filed a bug for this, but in the meantime... Is there a way of making them centered in Firefox without breaking them in Chrome?

<dom-module id="portfolio-display">
  <style>
    :host[show] {
      @apply(--layout-horizontal);
      @apply(--layout-center-justified);
      height: 100%;
      width: 100%;
      background-color: var(--paper-grey-50);
     }
    #main {
      width: 100%;
      margin-top: 50px;
    }
  </style>

  <template>
    <template is="dom-if" if="{{show}}">
      <iron-media-query query="(min-width: 900px)" query-matches="{{queryMatches}}"></iron-media-query>
      <div id="main">
        <div class="layout vertical center center"> 
          <portfolio-first-row class$="{{computeMediaSize(queryMatches)}}"></portfolio-first-row>
          <portfolio-second-row  class$="{{computeMediaSize(queryMatches)}}"></portfolio-second-row>
          <portfolio-third-row  class$="{{computeMediaSize(queryMatches)}}"></portfolio-third-row>
        </div>
      </div>
    </template>
  </template>

  <script>
    Polymer({
      is: "portfolio-display",
      properties: {
        show: {
          type: Boolean,
          reflectToAttribute: true,
          value: false
        }
      },
      toggleShow: function() {
        this.show = !this.show;
      },
      computeMediaSize: function (smallScreen) {
        if (!smallScreen) {
          return "layout vertical center center";
        }
      }
    });
  </script>
</dom-module>

enter image description here

Luby answered 27/9, 2015 at 21:10 Comment(5)
It'll be great if you could raise an issue in Github in the iron-flex-layout. I think the Polymer project owners will appreciate this feedback.Inextensible
github.com/PolymerElements/iron-flex-layout/issues/34Luby
You need to show more of your code. I don't think it's got anything to do with Polymer layout as your above code works fine in both Firefox and Chrome. Did you notice even in your header the Home and Contact menu items got shifted to the left? Something else is not right here.Lovelady
Ya, that was some other code I had shifting the header. I removed it and now it works as it should. Strange how it effected the layout.Luby
If you want to know why, post your code. :)Lovelady

© 2022 - 2024 — McMap. All rights reserved.