Css 聚合物纸张项目中的样式化html是否可行?
我试图在Css 聚合物纸张项目中的样式化html是否可行?,css,polymer,paper-elements,Css,Polymer,Paper Elements,我试图在纸质菜单的项目中添加一些丰富的内容,但这似乎没有达到预期效果(见下面的屏幕截图) 要将样式化html添加到纸张项目,需要做什么 代码如下: <style is="custom-style"> .personItem { @apply(--layout-horizontal); margin: 16px 16px 0 16px; padding: 20px; border-radius: 8px;
纸质菜单的项目中添加一些丰富的内容,但这似乎没有达到预期效果(见下面的屏幕截图)
要将样式化html添加到纸张项目
,需要做什么
代码如下:
<style is="custom-style">
.personItem {
@apply(--layout-horizontal);
margin: 16px 16px 0 16px;
padding: 20px;
border-radius: 8px;
background-color: white;
border: 1px solid #ddd;
}
.avatar {
height: 50px;
width: 50px;
border-radius: 25px;
box-sizing: border-box;
background-color: #DDD;
}
.pad {
padding: 0 16px;
@apply(--layout-flex);
@apply(--layout-vertical);
}
.primary {
font-size: 16px;
font-weight: bold;
}
.dim {
color: gray;
}
</style>
<paper-menu-button vertical-align="top" horizontal-align="right" vertical-offset="64">
<paper-icon-button id="notif" icon="social:notifications" class="dropdown-trigger" alt="menu"></paper-icon-button>
<paper-menu class="dropdown-content">
<template is="dom-repeat" items="[[notifications]]" as="item">
<paper-item>
<paper-item-body two-line>
<!--<div th:inline="none"><iron-icon icon='communication:message'></iron-icon></div>-->
<div secondary th:inline="none">
<div class="personItem">
<iron-image class="avatar" sizing="contain" src="[[item.pic]]"></iron-image>
<div class="pad">
<div class="primary" th:inline="none">
<span style="float:right;">[[m.date]]</span>
<span>[[m.user]]</span>
</div>
<div class="dim" th:inline="none">[[m.content]]</div>
</div>
</div>
</div>
</paper-item-body>
</paper-item>
</template>
</paper-menu>
</paper-menu-button>
<paper-badge id="badge" for="notif" label="[[number]]"></paper-badge>
潘森蒂姆先生{
@应用(--水平布局);
保证金:16px 16px 0 16px;
填充:20px;
边界半径:8px;
背景色:白色;
边框:1px实心#ddd;
}
.阿凡达{
高度:50px;
宽度:50px;
边界半径:25px;
框大小:边框框;
背景色:#DDD;
}
.pad{
填充:0 16px;
@应用(--layout-flex);
@应用(--垂直布局);
}
.小学{
字体大小:16px;
字体大小:粗体;
}
.昏暗{
颜色:灰色;
}
[[m.date]]
[[m.user]]
[[m.content]]
这或多或少产生了我想要实现的目标:
<paper-menu-button>
<paper-icon-button id="n" icon="social:notifications" class="dropdown-trigger" alt="menu"></paper-icon-button>
<paper-menu class="dropdown-content">
<template is="dom-repeat" items="[[notifications]]" as="item">
<paper-icon-item>
<iron-icon item-icon class="avatar" sizing="contain" src="/path/to/pic"></iron-icon>
<paper-item-body two-line>
<div>John Doe</div>
<div secondary>Hello World</div>
</paper-item-body>
<paper-icon-button icon="communication:message"></paper-icon-button>
</paper-icon-item>
</template>
</paper-menu>
</paper-menu-button>
<paper-badge id="badge" for="n" label="[[number]]"></paper-badge>
无名氏
你好,世界