我已经创建了一个带有文本的示例div,如下所示
< div class =“mydiv”matRipple matRippleColor =“rgba(255,255,0,.5)”> 点击我!< / DIV>它按预期工作,除了黄色出现……
当你检查元素时(我有这个代码 例 ),您可以注意到在文本之后创建颜色div。所以 的 不,你不能达到你想要的正确 强> 。
<div _ngcontent-c21="" class="example-ripple-container mat-elevation-z4 mat-ripple mat-ripple-unbounded" matripple=""> Click me <div class="mat-ripple-element" style="left: -107.606px; top: -161.106px; height: 511.211px; width: 511.211px; background-color: rgba(255, 255, 0, 0.5); transition-duration: 400ms; transform: scale(1); opacity: 0;"></div> </div>
的 但是有一个黑客可以做到这一点 强> :
.mat-ripple-element{ z-index:-1 !important; } .mat-ripple{ z-index:50; // 50 for example }