2017-10-04 51 views
-1

我有一个元素,其中有很多像标题,图像,视频等其他元素。我试图使透明仿古白色(使用不透明属性)的背景颜色,但然后图像并且内部的视频也变得透明。 如何绕过该反应?如何使<main>背景色透明但不包含其内的元素?

+0

在这里看到如何做一个[最小,完整,可验证的示例](https://stackoverflow.com/help/mcve)。 – cosinepenguin

回答

0

让我们试试这个:

body{ 
    color:black; 
} 
body::after { 
    content: ""; 
    background: url('image') no-repeat center center fixed; 
    background-size:  cover;   
    opacity: 0.6; 
    top: 0; 
    left: 0; 
    bottom: 0; 
    right: 0; 
    z-index: -1; 
}