HTML 和 CSS 文本背景黑色

标签 html css text background outline

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

这是我的问题的照片。

enter image description here

@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 ,这包括导航。

删除它并查看差异。

关于HTML 和 CSS 文本背景黑色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47101007/

相关文章:

css - 我如何知道 Quirks 模式是否在 IE6 中被触发?

css - 元素 :hover - text and background

c++ - 从原始文件中取出奇偶行到新文件,然后拼接回 C++

excel - 在单个单元格中搜索多个单词并返回找到的所有单词

html - 在django中截断html文本

javascript - 使用 colorbox 加载外部 url 然后 chop

html - CSS 规则泄漏到页面的其余部分

Javascript:插入变量作为参数

html - 图像在导航栏中未正确调整大小

javascript - 在悬停时在图像上书写