请问有什么办法能在我的这个代码里把文字设置成不透明吗
问题描述:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>作业2</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="header w">
<div class="logo">
<img src="千库.png" alt="">
</div>
<div class="nav">
<ul>
<li><a href="#">网站首页</a></li>
<li><a href="#">关于我们</a></li>
<li><a href="#">新闻中心</a></li>
<li><a href="#">产品中心</a></li>
<li><a href="#">联系我们</a></li>
</ul>
</div>
</div>
<div class="banner">
<div class="w">
<div class="subnav">
<ul>
<li><a href="#"> <span class="subnav"> </span></a></li>
</ul>
</div>
<div class="fr">
<ul>
<li>学海<span style="color: orangered;">无涯</span></li>
<hr></hr>
<p>QIANKU</p>
<p1>你要的教材这里都有</p1>
</ul>
</div>
<div class="fl">
<ul>
<li><a href="#"> <span class="fl"> </span></a></li>
</ul>
</div>
</div>
</div>
</body>
</html>
* {
margin: 0;
padding: 0;
}
.w {
width: 2000px;
margin: auto;
}
body {
background-color:transparent;
}
li {
list-style: none;
}
a {
text-decoration: none;
}
.clearfix:before,.clearfix:after {
content:"";
display:table;
}
.clearfix:after {
clear:both;
}
.clearfix {
*zoom:1;
}
.header{
height: 90px;
margin: auto;
background:black;
opacity: 0.4;
}
.logo{
float:left;
weight:47px;
height: 90px;
padding-top: 20px;
margin-left: 200px;
}
.nav{
float:left;
margin-left: 204px;
}
.nav ul li{
float:left;
margin: 0 45px;
}
.nav ul li a {
display: block;
height: 90px;
padding: 0px;
line-height: 90px;
font-size: 18px;
color: white;
}
.nav ul li a:hover {
border-bottom: 2px solid #ff812a;
color: #ff812a;
}
.banner {
clear:both;
height: 688px;
background-color:transparent;
}
.banner .w {
height: 688px;
background: url(4573.png) no-repeat top center;
background-size: cover;
}
.subnav {
float: left;
width: 100px;
height: 688px;
display :inline-block;
position: relative;
background-color:transparent;
}
.subnav::after {
display: inline-block;
content: " ";
height: 45px;
width: 50px;
border-width: 3px 3px 0 0;
border-color: white;
border-style: solid;
transform: matrix(-0.71, -0.71, 0.71, -0.71, 0, 0);
position: absolute;
top: 48%;
left: 25px;
}
.fr{
float: left;
width:935px;
height: 359px;
background:black;
opacity: 0.3;
margin: 157px 230px auto;
font-weight: bold;
}
.fr ul li {
width:935px;
height:166px;
line-height: 166px;
margin-left: 240px;
margin-top: 20px;
font-size: 120px;
color: white;
}
.fr ul p {
width:935px;
height:5px;
line-height: 5px;
margin-left: 425px;
margin-top: 30px;
font-size: 35px;
color: white;
}
.fr ul hr {
width:933px;
height:5px;
line-height: 5px;
margin-left: 0px;
margin-top: 30px;
font-size: 35px;
color: white;
}
.fr ul p1 {
width:935px;
height:100px;
line-height: 100px;
margin-left: 350px;
margin-top: 400px;
font-size: 35px;
color: white;
}
.fl {
float: left;
display :inline-block;
position: relative;
width: 490px;
height: 688px;
background-color:transparent;
}
.fl::after {
display: inline-block;
content: " ";
height: 45px;
width: 50px;
border-width: 3px 3px 0 0;
border-color: white;
border-style: solid;
transform: matrix(0.71, 0.71, -0.71, 0.71, 0, 0);
position: absolute;
top: 48%;
left: 250px;
}
答
哪里黑盒子
答
把opacity:.4;background:black; 换成rgba(0,0,0,.4) 应该可以