HTML 和 CSS 文本背景黑色

HTML and CSS text background black

我不知道如何去掉导航后面的黑色。当我查看每个元素时,在我看来所有 css 样式都不是黑色的。

这是我的问题的照片。

@charset "UTF-8";

/* CSS Document */

* {
  background-color: black;
}

body,
html {
  margin: 0;
  padding: 0;
}

video {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  min-width: 100%;
  min-height: 100%;
  width: auto;
  height: auto;
  z-index: 1;
}

.text {
  background: rgba(0, 0, 0, 0);
  z-index: 3;
  position: relative;
  color: white;
  font-family: Helvetica;
  text-align: left;
  padding-top: 50px;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  font-size: 30px;
  letter-spacing: 8px;
  text-transform: capitalize;
  padding-left: 40px;
}

.contact {
  background: rgba(0, 0, 0, 0);
  z-index: 3;
  position: relative;
  color: white;
  font-family: Helvetica;
  text-align: right;
  padding-right: 20px;
  font-weight: 200;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  font-size: 20px;
  letter-spacing: 3px;
  text-transform: capitalize;
}

#nav li {
  color: white;
  position: relative;
  font-size: 22px;
  font-weight: 200;
  z-index: 2;
  font-family: helvetica;
  padding-left: 20px;
  list-style: none;
  /*border: solid;*/
  letter-spacing: 4px;
  text-align: left;
  width: 250px;
  text-decoration: underline;
  line-height: 35px;
  background: none;
  /*border-radius: 100px;*/
}

#nav li a {
  text-decoration: none;
  color: white;
}

#nav li a:hover {
  color: #c1c1c1;
}

.contact a {
  text-decoration: none;
  color: white;
}

.contact a:hover {
  color: #c1c1c1;
}
<div class="banner">
  <video poster="pic.png" autoplay="true" loop="loop" muted>
 <source src="Melanie.mp4" type="video/mp4">
 <source src="Melanie.webm" type="video/webm">
 </video>
  <div class="text">MELANIE PULLEN</div>
  <div class="contact"><a href="#">Contact</a></div>
  <div id="nav">
    <ul>
      <li><a href="#">WORK  </a></li>
      <li><a href="#">INSTALLATIONS </a></li>
      <li><a href="#">CRIME SCENES  </a></li>
      <li><a href="#">BIOGRAPHY </a></li>
      <li><a href="#">PRESS</a></li>


    </ul>
  </div>
</div>

你有这个:

*{
    background-color:black;
}

这表示 html 文档中的每个元素都将具有 background-color:black ,这包括导航。

去掉看看区别

您应该可以通过 CSS 不透明度...不透明度 = 0...或尝试将背景图像设置为透明来解决此问题。

https://www.w3schools.com/css/css_image_transparency.asp