简体   繁体   English

无法从图像滑块上方的引导导航中删除背景色

[英]Cant remove background color from bootstrap nav over image slider

To clarify, I am trying to change the second nav bar from the top to be transparent so you can see through it to the image behind it. 为了澄清起见,我试图将第二个导航栏从顶部更改为透明,以便您可以将其导航到其后面的图像。

I applied this CSS to the navbar which usually will work for transparency: 我将此CSS应用于导航栏,该导航栏通常可以提高透明度:

#nav > .navbar-inner {
border-width: 0px;
-webkit-box-shadow: 0px 0px;
box-shadow: 0px 0px;
background-color: rgba(0,0,0,0.0);
background-image: -webkit-gradient(linear, 50.00% 0.00%, 50.00% 100.00%, color-stop( 0% , rgba(0,0,0,0.00)),color-stop( 100% , rgba(0,0,0,0.00)));
background-image: -webkit-linear-gradient(270deg,rgba(0,0,0,0.00) 0%,rgba(0,0,0,0.00) 100%);
background-image: linear-gradient(180deg,rgba(0,0,0,0.00) 0%,rgba(0,0,0,0.00) 100%);

But I think there is something happening with the slider where, although the nav is inside the slider div, it is still pushing the slider image down. 但是我认为滑块发生了一些变化,尽管导航位于滑块div内,但它仍将滑块图像向下推。 When I use margin-top:-2em to pull the slider back up underneath the nav, it still doesn't have transparency on the navigation. 当我使用margin-top:-2em将导航条拉回到导航器下方时,它在导航上仍然没有透明度。 If you scroll down on the page, you will see the transparent background on the navigation as you should. 如果在页面上向下滚动,您将在导航上看到应有的透明背景。 Any tips are much appreciated. 任何提示,不胜感激。

use this in your style.css file. 在style.css文件中使用它。

.carousel-control.left {background-image:none;}
.carousel-control.right {background-image:none;}
  • Change below height to 90%. 低于height更改为90%。

.carousel-inner { height: 100%; }

  • And remove the top-margin for #imagebox . 并删除#imageboxtop-margin

cannot give top:0 for .carousel-control with the current markup since it will overlap the menu. 无法使用当前标记为.carousel-control提供top:0 ,因为它将与菜单重叠。 Otherwise you should give white background color to the #nav-wrapper and bring it to front using z-index. 否则,您应该为#nav-wrapper提供白色背景色,并使用z-index将其显示在前面。


Another suggestion is that it will be better if you could add a new div with <div class="spotlight"> wrapping carousel-indicators , carousel-indicators , left carousel-control and right carousel-control . 另一个建议是,如果您可以添加带有<div class="spotlight">包装carousel-indicatorscarousel-indicatorsleft carousel-controlright carousel-control的新div会更好。

.spotlight {
   position: relative;
   width: 100%;
   height: 90%;
}

Just remove the background-image from .carousel-control.right and .carousel-control.left 只需从.carousel-control.right.carousel-control.left删除background-image

As you can see the below image, there is no color (technically background-image). 如您所见,下面的图像没有颜色(技术上是背景图像)。 Hope this is what you are looking for. 希望这是您想要的。 在此处输入图片说明

add this as Abdullah Ibn Farouk said 将此添加为Abdullah Ibn Farouk所说

.carousel-control.left {background-image:none;}
.carousel-control.right {background-image:none;}

and this is for image to fit properly.. 这是为了使图像合适。

 .fill{
width: 100%;
  height: 100%;

  background-size: cover;
}

bootstrap.min.css更改

.carousel-control.left, .carousel-control.right { background-image: none; }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM