透明覆盖背景图像CSS

透明覆盖背景图像CSS,css,Css,我有一个全屏幕的背景图像,但我想在它的不透明度为0.7黑色覆盖 这是我的代码: body { background:url(../images/bg.jpg) no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover;} 我该怎么做 我的html

我有一个全屏幕的背景图像,但我想在它的不透明度为0.7黑色覆盖

这是我的代码:

body { 
  background:url(../images/bg.jpg) no-repeat center center fixed; 
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;}
我该怎么做

我的html

<!DOCTYPE html>
<!--[if lt IE 7 ]><html class="ie ie6" lang="en"> <![endif]-->
<!--[if IE 7 ]><html class="ie ie7" lang="en"> <![endif]-->
<!--[if IE 8 ]><html class="ie ie8" lang="en"> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!--><html lang="en"> <!--<![endif]-->
<head>

    <!-- Basic Page Needs
  ================================================== -->
    <meta charset="utf-8">
    <title>New Year Countdown</title>
    <meta name="description" content="">
    <meta name="author" content="">

    <!-- Mobile Specific Metas
  ================================================== -->
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

    <!-- CSS
  ================================================== -->
    <link rel="stylesheet" href="css/style.css">


    <!-- Favicon
    ================================================== -->
    <link rel="shortcut icon" href="images/favicon.ico">


</head>
<body>


<div id="over">k</div>

</body>
</html>

新年倒计时
K

覆盖层必须是不透明覆盖层。

使用div并指定一个覆盖整个主体的透明类,然后使用:

.transparent {
    background:rgba(255,255,255,0.5);
}
这将完成任务


同时进行:

您也可以使用以下技巧进行计算:

background-color: black; /* The shade of black that you want*/
background-blend-mode: multiply;

所以我这么做了,但还是不行。我使用骨架作为我的框架。你知道怎么办吗?我已经发了我的htmlhere's a FIDLE。。我错误地转到255忘记了将是0:):p这不是真正的问题,在我完成上述操作后,我仍然看不到任何变化。我通过了骨架框架。这没有什么不同,但事实是,如果您试图修改第三方div的css,即可能来自skeletong框架的div,请尝试使用相同的样式,如
.transparent{background:rgba(255255255,0.5)!important;}
,因为在运行时,jquery可能会更改它们。如果正在使用:)