0

我在我的自定义元素中使用了一个聚合物核心图标,并尝试通过它的元素名称来设置它的样式。我的示例中的按钮显示为蓝色背景,为什么核心图标没有显得更大(200X200px)?我是不是误会了什么?

<html>
<head>
    <title></title>
    <script src="bower_components/webcomponentsjs/webcomponents.js"></script>
    <link rel="import" href="bower_components/polymer/polymer.html">
    <link rel="import" href="bower_components/core-icons/core-icons.html">
    <polymer-element name="test-one" noscript>
        <template>
            <style>
                core-icon {
                    width: 200px;
                    height: 200px;
                }
                button {
                    background-color: blue;
                }
            </style>
            <h1><core-icon icon="android"></core-icon>howdy! </h1>
            <button>I'm a button</button>
        </template>
    </polymer-element>
</head>
<body>
    <test-one>transclude me!</test-one>
</body>
</html>
4

1 回答 1

0

似乎 html /deep/ core-icon 样式不会被标记样式覆盖,您需要使用 icon 属性给 core-icon 一个额外的 id 并以此设置样式。

于 2014-11-17T18:02:05.550 回答