如何使此导航栏透明?

时间:2016-12-29 05:20:21

标签: html css twitter-bootstrap css3

我已经在很长一段时间内摆弄了CSS,没有任何效果。

我成功地改变了文字颜色,但背景颜色仍然很顽固

来源:blackdeath1098.github.io

3 个答案:

答案 0 :(得分:2)

你用过......

.navbar-default {
    background-color: rgba(0, 0, 0, 0);
}

你应该使用什么......

.navbar-default {
    background: transparent;
}

<强> DEMO

答案 1 :(得分:0)

你用过......

.navbar-default {
    background-color: rgba(0, 0, 0, 0);
}

你需要使用什么......

.navbar-default {
    background-color: rgba(0, 0, 0, 1);
}

答案 2 :(得分:0)

.navbar-default {
    background-color: transparent !important;
    border-color: transparent !important;
}
<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap Case</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body style="background-color: #ccffff;">

<nav class="navbar navbar-default">
  <div class="container-fluid">
    <div class="navbar-header">
      <a class="navbar-brand" href="#">WebSiteName</a>
    </div>
    <ul class="nav navbar-nav">
      <li class="active"><a href="#">Home</a></li>
      <li><a href="#">Page 1</a></li>
      <li><a href="#">Page 2</a></li>
      <li><a href="#">Page 3</a></li>
    </ul>
  </div>
</nav>
  
<div class="container">
  <h3>Basic Navbar Example</h3>
  <p>A navigation bar is a navigation header that is placed at the top of the page.</p>
</div>

</body>
</html>