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

青春壹個敷衍的年華 提交于 2019-12-04 15:32:36

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);
    };
}
sfeast

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

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