<分区>
<分区>
我正在创建一个网站,它有菜单,有一个类顶部栏和白色背景,我想让它不完全透明,但我仍然可以看到白色我正在使用 Dreamweaver,所以我该怎么做
<html>
<head>
<title></title>
<style type="text/css">
a{
text-decoration:none;
color:black;
}
a:hover{
text-decoration:underline;
}
ul{
list-style:none;
}
li{
float:left;
font-size:20px;
padding-left:10px;
}
.background{
margin:0;
background-image:url("MWYLJ6SRDM.jpg");
background-size:1380px auto;
background-repeat:no-repeat;
background-attachment:fixed;
background-position:center;
}
.topbar{
background-color:white;
height:50px;
width:100%;
color:black;
position:fixed;
z-index:1;
}
</style>
</head>
<body class="background">
<div class="topbar">
<ul>
<li><a href="">Home</a></li>
<li><a href="">About Us</a></li>
<li><a href="">Contact Us</a></li>
</ul>
</div>
</body>
</html>
最佳答案
您可以使用:
background-color:rgba(255, 255, 255, 0.5);
示例中的“0.5”值表示不透明度值,您可以在其中调整透明度。其他值表示 RGB 值,因此您可以使用它们调整背景颜色。
关于html - 如何在 html 和 css 中创建透明背景颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38012497/