gpt4 book ai didi

css - polymer 1.x : Formatting

转载 作者:行者123 更新时间:2023-11-28 16:46:06 24 4
gpt4 key购买 nike

我有纸按钮元素......

This JSFiddle shows the target result I seek for the button hover effect . (即,整个按钮填满工具栏的整个高度,并且没有边距,需要在悬停时突出显示)。

...但我需要 paper-menu-button 元素。

上面使用的是 <paper-button> .但我真的很想用 <paper-menu-button> . This JSFiddle is the best attempt I have so far . (请注意按钮上方和下方的空白区域——悬停时不会突出显示。)


问题

Please help me format the second JSFiddle to look (on hover) like the first JSFiddle. (I.e., no white space. Fills entire height of toolbar.)

Please provide a working JSFiddle or JSBin in your answer.

注意:我使用了 x许多 CSS 样式属性前面的字符作为注释属性的快速方法我已经尝试过但没有用。


代码

...这个效果就是目标... http://jsfiddle.net/L3bqphwe/2/
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Polymer Bin</title>
<base href="http://element-party.xyz/">
<script src="bower_components/webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="all-elements.html">
<style>
paper-toolbar *:last-child {
margin-right: -8px;
}
</style>
</head>
<body class="fullbleed layout vertical">
<paper-header-panel>
<paper-toolbar>
<span>Header</span>
<span class="flex"></span>
<x-element></x-element>
</paper-toolbar>
<div>Content goes here...</div>
</paper-header-panel>
<dom-module id="x-element">
<template>
<style>
:host {
--paper-button: {
@apply(--layout-vertical);
@apply(--layout-center-center);
};
--paper-menu-button: {
@apply(--layout-vertical);
@apply(--layout-center-center);
height: 100%;
};
border-left: 1px solid white;
height: 100%;
}
paper-menu-button {
margin: 0;
padding: 0;
height: 100%;
xborder-left: 1px solid var(--paper-grey-600);
--paper-menu-button: {
@apply(--layout-vertical);
@apply(--layout-center-center);
@xapply(--height-100%);
xheight: 100%;
};
}
paper-button:hover {
background: white;
color: black;
font-weight: bold;
}
paper-button {
--paper-button: {
@apply(--layout-vertical);
@apply(--layout-center-center);
};
color: white;
height: 100%;
border-radius: 0;
margin:0;
-o-transition : .25s;
-ms-transition : .25s;
-moz-transition : .25s;
-webkit-transition : .25s;
transition : .25s;
}
</style>
<paper-button>Button</paper-button>
</template>
<script>
(function(){
Polymer({
is: 'x-element'
});
})();
</script>
</dom-module>
</body>
</html>
...我到目前为止...需要帮助... http://jsfiddle.net/L3bqphwe/3/
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Polymer Bin</title>
<base href="http://element-party.xyz/">
<script src="bower_components/webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="all-elements.html">
<style>
paper-toolbar *:last-child {
margin-right: -5px;
}
</style>
</head>
<body class="fullbleed layout vertical">
<paper-header-panel>
<paper-toolbar>
<span>Header</span>
<span class="flex"></span>
<x-element></x-element>
</paper-toolbar>
<div>Content goes here...</div>
</paper-header-panel>
<dom-module id="x-element">
<template>
<style>
:host {
--paper-button: {
@apply(--layout-vertical);
@apply(--layout-center-center);
};
--paper-menu-button: {
@apply(--layout-vertical);
@apply(--layout-center-center);
height: 100%;
};
border-left: 1px solid white;
height: 100%;
}
paper-menu-button {
margin: 0;
padding: 0;
height: 100%;
xborder-left: 1px solid var(--paper-grey-600);
--paper-menu-button: {
@apply(--layout-vertical);
@apply(--layout-center-center);
@xapply(--height-100%);
xheight: 100%;
};
}
paper-button:hover {
background: white;
color: black;
font-weight: bold;
}
paper-button {
--paper-button: {
@apply(--layout-vertical);
@apply(--layout-center-center);
};
color: white;
height: 100%;
border-radius: 0;
margin:0;
-o-transition : .25s;
-ms-transition : .25s;
-moz-transition : .25s;
-webkit-transition : .25s;
transition : .25s;
}
</style>
<paper-menu-button>
<paper-button class="dropdown-trigger">Button</paper-button>
<paper-menu class="dropdown-content">
<paper-item>Share</paper-item>
<paper-item>Settings</paper-item>
<paper-item>Help</paper-item>
</paper-menu>
</paper-menu-button>
</template>
<script>
(function(){
Polymer({
is: 'x-element'
});
})();
</script>
</dom-module>
</body>
</html>

最佳答案

问题是你给

height: 100%

到 paper-button.x-element

但是 parent 正在限制这个高度。

所以简单的加上

#trigger {
height: 100%;
}

#trigger.style-scope.paper-menu-button

关于css - polymer 1.x : Formatting <paper-menu-button>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33145294/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com