Bootstrap渐变背景无法正确呈现

时间:2019-10-04 10:13:56

标签: html css bootstrap-4 gradient

我的导航栏中有一个汉堡图标的背景渐变。 如您在摘要结果中所见,它的左右两侧都有一些奇怪的“边界”。

如何使这些边界消失?

.btn-primary {
  border-color: transparent !important;
  background-color: transparent !important;
  display: inline-block;
  height: 40px;
  background: #0080eb;
  background: linear-gradient(90deg,#0080eb 0,#00d3eb 100%);
  color: #fff;
  font-size: 13px !important;
  font-weight: 700;
  border-radius: 20px !important;
  padding: 0 9px !important;
  line-height: 40px;
  box-shadow: 0 10px 13px -10px rgba(0,128,235,.75);
}
.bg-primary.container {
  background-color:transparent !important;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.3/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet"/>

<div id="wrapper-navbar" itemscope="" itemtype="http://schema.org/WebSite" class="fixed-top white-transp-gradient">

  <a class="skip-link sr-only sr-only-focusable" href="#content">Salta al contenuto</a>

    <nav class="navbar navbar-expand-md navbar-light bg-primary container">

      <button class="navbar-toggler btn-primary" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
        <span class="navbar-toggler-icon"></span>
      </button>

      <!-- The WordPress Menu goes here -->
      <div id="navbarNavDropdown" class="collapse navbar-collapse">
      <ul id="main-menu" class="navbar-nav ml-auto">
        <li itemscope="itemscope" itemtype="https://www.schema.org/SiteNavigationElement" id="menu-item-13" class="menu-item menu-item-type-custom menu-item-object-custom current-menu-item current_page_item menu-item-home active menu-item-13 nav-item"><a title="Home" href="http://example.test/" class="nav-link">Home</a></li>

      </ul>
</div>					
					
			</nav><!-- .site-navigation -->

		</div>

1 个答案:

答案 0 :(得分:2)

这是id, output 101,Yes 问题,添加border,它可以正常工作,请检查以下内容:-

border: 0 !important
.btn-primary {
  border-color: transparent !important;
  background-color: transparent !important;
  display: inline-block;
  width: 40px;
  height: 40px;
  background: #0080eb;
  background: linear-gradient(90deg,#0080eb 0,#00d3eb 100%);
  color: #fff;
  font-size: 13px !important;
  font-weight: 700;
  border-radius: 20px !important;
  padding: 0 9px !important;
  line-height: 40px;
  box-shadow: 0 10px 13px -10px rgba(0,128,235,.75);
  border: 0 !important;
}
.bg-primary.container {
  background-color:transparent !important;
}