我想使div透明的方式,通過它可以看到背景圖像。所有在線教程似乎都有效,但似乎我錯過了重要項目中的一些細節。使一個div透明,並顯示背景圖片
CSS:
html {
background: url('../images/background.jpg') no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
div.container-fluid{
/*-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"; */
/*filter: alpha(opacity=0); */
/*-moz-opacity: 0.0; */
/*-khtml-opacity: 0.0; */
/*opacity: 0.0; */
/*background: rgba(255,255,255,0);*/
background-color: transparent !important;
color: #ffffff;
opacity: 0.2;
}
HTML:
<!DOCTYPE html>
<html>
<head>
<title>M</title>
<meta charset="utf-8" />
<meta http-equiv="X-UA-COMPATIBLE" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Cue"/>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<link type="text/css" rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css"/>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css" href="css/main.css" media="screen" />
</head>
<body>
<div class="container-fluid">
<div class="header">
<a href="" class="header-text">M</a>
<h1>M</h1>
</div>
<div class="content">
<main>
</main>
</div>
</div>
</body>
</html>
您的代碼正在爲我工作。你能更具體地說明什麼不起作用嗎? – Matt 2015-03-30 21:10:17