我正在使用免责声明进行覆盖,并为其添加了样式。由于某些原因,p
元素以不同的颜色显示。它将拒绝变为黑色。我该如何解决?
我已经尝试使用!important
和opacity: 1;
@import url('https://fonts.googleapis.com/css?family=Poppins&display=swap');
@import url('https://fonts.googleapis.com/css?family=Asap');
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
height: 100vh;
}
.overlay {
background: rgb(20, 20, 20);
opacity: 0.4;
height: 100%;
align-items: center;
justify-content: space-around;
display: flex;
}
.disclaimer {
background: white;
opacity: 1 !important;
width: 28%;
height: 28%;
align-items: center;
}
.heading-disclaimer {
color: black !important;
opacity: 1 !important;
font-family: Poppins, sans-serif;
width: 100%;
z-index: auto;
text-align: center;
}
.p-disclaimer {
padding-top: 20px;
font-size: 17px;
z-index: auto;
opacity: 1 !important;
font-family: Asap;
width: 100%;
color: black !important;
text-align: center;
}
<div class="overlay">
<!-- Roblox Version -->
<div class="disclaimer">
<h1 class="heading-disclaimer">Disclaimer</h1>
<p class="p-disclaimer">
Disclaimer!
</p>
<button class="ok">OK</button>
</div>
</div>
我希望颜色为黑色,但是当我执行color: black;
结果显示为灰色,可能与覆盖背景的颜色相同。
答案 0 :(得分:1)
// ***********************************
mouseEnter: function (e, obj) {
console.log("mouse enter"); },
mouseLeave: function (e, obj) {
console.log("mouse leave"); },
mouseDragEnter: function (e, node, prev) {
console.log("mouse drag enter");
},
mouseDragLeave: function (e, node, next) {
console.log("mouse drag leave");
},
mouseDrop: function (e, node) {
console.log("mouse drag drop");
},
// ***********************************
是p
的子元素,因此overlay
是其父元素inherit
的元素。您只需为此用途opacity
更改父级opacity
的{{1}},
更改
background
到
rgba
.overlay {
background: rgb(20, 20, 20);
opacity: 0.4;
.overlay {
background: rgba(20, 20, 20, 0.4);