polymer 1.0 how to central justify the paper-card heading?

六眼飞鱼酱① 提交于 2020-01-13 06:33:25

问题


I am trying this to central justify the paper card heading:

paper-card [heading]{
      @apply(--center-justified);
    }

but it does not seem to help. kindly suggest


回答1:


heading is not an attribute so you cannot write like that.

You basically need to style the .title-text element inside the shadow dom, so use this instead -

paper-card::shadow #shadow .header .title-text {
    display: flex;
    justify-content: center;
}

Or use the polymer iron-flex-layout -

paper-card::shadow #shadow .header .title-text {
    @apply(--layout-vertical);
    @apply(--layout-center);
}

Update

Thanks to @sfeast for pointing it out. Since shadow selectors will be deprecated, the above styles need to be applied to the mixins like this -

paper-card {
    --paper-card-header: {
        @apply(--layout-vertical);
        @apply(--layout-center);
    };
}



回答2:


The accepted answer is going to break since the shadow selector is/has been already I believe, deprecated.

The --paper-card-header mixin is available for what you would like to do. See the example for using mixins here - https://www.polymer-project.org/1.0/docs/devguide/styling.html#custom-css-mixins



来源:https://stackoverflow.com/questions/32025315/polymer-1-0-how-to-central-justify-the-paper-card-heading

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!