Cannot remove shaded background of carousel - CSS - css

LINK TO WEBSITE TEST PAGE:
WEBPAGE LINK
I'm trying to have a carousel with no background. So the images and indicators are just displayed as is.
Have tried this:
.carousel{
background:none;
background-color: none;
}
Which didn't make a difference, I also tried adding a placeholder as a background to see what it did:
.carousel{
background: url(http://placehold.it/620x420/);
}
This added the placeholder background but behind the shading of the carousel. I've uploaded an image here:
Hopefully someone knows what I've done wrong, thanks in advance.
EDIT: Added HTML code for carousel:
<!-- Image Gallery Start-->
<br/><br/>
<div id="Carousel" class="carousel slide" data-ride="carousel" style="max-width: 400px; margin: 0 auto">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#suniceCarousel" data-slide-to="0" class="active"></li>
<li data-target="#suniceCarousel" data-slide-to="1"></li>
<li data-target="#suniceCarousel" data-slide-to="2"></li>
<li data-target="#suniceCarousel" data-slide-to="3"></li>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner" role="listbox">
<div class="item active">
<img class="img-responsive center-block" src="/images/sunice/sunice1.png" width="350" alt="Chania">
</div>
<div class="item">
<img class="img-responsive center-block" src="/images/sunice/sunice2.png" width="350" alt="Chania">
</div>
<div class="item">
<img class="img-responsive center-block" src="/images/sunice/sunice1.png" width="350" alt="Chania">
</div>
<div class="item">
<img class="img-responsive center-block" src="/images/sunice/sunice2.png" width="350" alt="Chania">
</div>
</div>
<!-- Left and right controls -->
<a class="left carousel-control" href="#Carousel" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#Carousel" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
</br></br>
<!-- Image gallery end-->

If I've understood you just want to remove the gradient the chevrons have for a background?
#Carousel .carousel-control.left,
#Carousel .carousel-control.right {
background-image: none;
}
This should be all you need. Here is an example below
#Carousel .carousel-control.left,
#Carousel .carousel-control.right {
background-image: none;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<!-- Image Gallery Start-->
<br/>
<br/>
<div id="Carousel" class="carousel slide" data-ride="carousel" style="max-width: 400px; margin: 0 auto">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#suniceCarousel" data-slide-to="0" class="active"></li>
<li data-target="#suniceCarousel" data-slide-to="1"></li>
<li data-target="#suniceCarousel" data-slide-to="2"></li>
<li data-target="#suniceCarousel" data-slide-to="3"></li>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner" role="listbox">
<div class="item active">
<img class="img-responsive center-block" src="http://www.newventureactive.co.uk/images/sunice/sunice1.png" width="350" alt="Chania">
</div>
<div class="item">
<img class="img-responsive center-block" src="http://www.newventureactive.co.uk/images/sunice/sunice2.png" width="350" alt="Chania">
</div>
<div class="item">
<img class="img-responsive center-block" src="http://www.newventureactive.co.uk/images/sunice/sunice1.png" width="350" alt="Chania">
</div>
<div class="item">
<img class="img-responsive center-block" src="http://www.newventureactive.co.uk/images/sunice/sunice2.png" width="350" alt="Chania">
</div>
</div>
<!-- Left and right controls -->
<a class="left carousel-control" href="#Carousel" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#Carousel" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
</br>
</br>
<!-- Image gallery end-->

Try This
.carousel-inner .active{
background:none !important;
}

I've checked the online example, the carousel adds the class active to the current active item.
In your style.css the active class has the following style:
.active{
background: url("images/active-bg.png") repeat scroll 0 0 rgba(0, 0, 0, 0) !important;
color: #fff !important;
}
you just need to remove the background property and you'll have a transparent background for every carousel item.

Only this worked:
<a class="left carousel-control" href="#myCarousel" data-slide="prev" style="background-image:none">
<a class="right carousel-control" href="#myCarousel" data-slide="next" style="background-image:none">
Nothing else worked for me.

Related

Negative top margin + overflow:hidden on Boostrap carousel

I have a generic bootstrap v3.7 carousel and I'm trying to pull it up over the content above it like this
This is done with a margin-top: -50px; on the teal div. However, the hidden overflow property of the carousel is causing the top to be cut off above the top of the div, so I cannot achieve this overlay design. My attempts to modify the CSS have only broken the carousel. Is it possible to do this?
The margin-top should be applied the div containing .carousel, perhaps you are using it on the div with the calls carousel;
Following code snippet is what you're trying to achieve:
.aboveCarousel {
height: 300px;
background: magenta;
}
.container {
margin-top: -50px
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>
<div class='aboveCarousel'> </div>
<div class="container">
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner">
<div class="item active">
<img src="https://www.w3schools.com/bootstrap/la.jpg" alt="Los Angeles" style="width:100%;">
</div>
<div class="item">
<img src="https://www.w3schools.com/bootstrap/chicago.jpg" alt="Chicago" style="width:100%;">
</div>
<div class="item">
<img src="https://www.w3schools.com/bootstrap/ny.jpg" alt="New york" style="width:100%;">
</div>
</div>
<!-- Left and right controls -->
<a class="left carousel-control" href="#myCarousel" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#myCarousel" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
<span class="sr-only">Next</span>
</a>
</div>
</div>

full width banner size on extra large screen device (width>1366px)

HTML
<div class="container-fluid no-padding">
<div id="mainSlide" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#mainSlide" data-slide-to="0"></li>
<li data-target="#mainSlide" data-slide-to="1"></li>
<li data-target="#mainSlide" data-slide-to="2"></li>
</ol>
<div class="carousel-inner img-responsive">
<div class="item active">
<img src="1.jpg" alt="nature1">
</div>
<div class="item">
<img src="2.jpg" alt="nature2">
</div>
<div class="item">
<img src="3.jpg" alt="nature3">
</div>
<a class="left carousel-control" href="#mainSlide" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#mainSlide" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
<span class="sr-only">Next</span>
</a>
</div>
</div>
</div>
CSS
.no-padding{
padding: 0px;
}
.item {
height: 100%;
width: 100%;
}
Problem
As it can be seen in the banner it shows abnormally on larger screen,how can it be fixed.On smaller screen (<=1366px) banner works fine.How to fix this,thanks in advance for your help.
Add width: 100% to the <img> preferably using a class.
Here is my codepen: https://codepen.io/CodeBoyCode/pen/jeQOmG
let me know if this isn't what you were after

carousel overlaps to fixed nav bar when view is changed

My HTML is this:
<div class="navbar navbar-fixed-top" >
some divs inside...
</div>
<div class="filler"> </div>
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
</ol>
<div class="carousel-inner" role="listbox">
<div class="item active">
<img class="first-slide" src="<?php print(base_url('assets/images/slide-one.jpg')); ?>" alt="First slide" />
<div class="container">
<div class="carousel-caption">
<div class="main-text">TEXT 1!</div>
<div class="sub-text">subtext</div>
</div>
</div>
</div>
<div class="item">
<img class="second-slide" src="<?php print(base_url('assets/images/slide-two.jpg')); ?>" alt="Second slide">
<div class="container">
<div class="carousel-caption">
<div class="main-text">TEXT 2</div>
<div class="sub-text">subtext </div>
</div>
</div>
</div>
</div>
<a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
CSS:
.filler {
height: 230px; //same height of class navbar.i do this so
carousel will not overlap the fixed navbar
}
The design runs OK. The top div is fixed at the top. But when I change the view to smaller or to mobile view, the carousel overlaps the fixed navbar. How will I format my css so that carousel will not overlap? Or is there another way to format this? Thank you.

How to add icons/images as indicators rather than list circles in bootstrap3 carousel slider

Hi i am trying to make a bootstrap3 carousel slider and I want to add some images as the slide indicators instead of the list default circles.
Html Markup :
<div id="carousel-slider" class="carousel slide" data-ride="carousel" data-interval="5000">
<!-- Slider Indicators -->
<ul class="carousel-indicators">
<li data-target="#carousel-slider" data-slide-to="0" class="active"></li>
<li data-target="#carousel-slider" data-slide-to="1"></li>
<li data-target="#carousel-slider" data-slide-to="2"></li>
</ul><!--/ Indicators end-->
</div>
if i add an img tag as below :
<div id="carousel-slider" class="carousel slide" data-ride="carousel" data-interval="5000">
<!-- Slider Indicators -->
<ul class="carousel-indicators">
<li data-target="#carousel-slider" data-slide-to="0" class="active">
<div class="thumbnail">
<img class="img-responsive" src="https://s3.amazonaws.com/ooomf-com-files/wdXqHcTwSTmLuKOGz92L_Landscape.jpg">
</div></li>
<li data-target="#carousel-slider" data-slide-to="1"></li>
<li data-target="#carousel-slider" data-slide-to="2"></li>
</ul><!--/ Indicators end-->
<div>
Its not showing anything. How can I achieve adding an image as the indicator rather than the circle?
I think the most important thing is to override the width and height properties on the li tags inside the .carousel-indicators.
To do so I've created an additional modifier css class called .carousel-indicators--thumbnails that is added to the .carousel-indicators div. This modifier class is used to override the li, .active and .active .thumbnail class.
.carousel-indicators.carousel-indicators--thumbnails li {
width: 80px;
height: 40px;
margin: 0;
border: none;
border-radius: 0;
}
.carousel-indicators.carousel-indicators--thumbnails .active {
background-color: transparent;
}
.carousel-indicators.carousel-indicators--thumbnails .active .thumbnail {
border-color: #337ab7;
}
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet" />
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
<div class="container">
<div class="row">
<div class="col-xs-12 col-md-8 col-md-offset-2">
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel" data-interval="5000">
<!-- Indicators -->
<ol class="carousel-indicators carousel-indicators--thumbnails">
<li data-target="#carousel-example-generic" data-slide-to="0" class="active">
<div class="thumbnail">
<img src="http://www.fillmurray.com/800/400" class="img-responsive">
</div>
</li>
<li data-target="#carousel-example-generic" data-slide-to="1">
<div class="thumbnail">
<img src="http://www.fillmurray.com/800/401" class="img-responsive">
</div>
</li>
<li data-target="#carousel-example-generic" data-slide-to="2">
<div class="thumbnail">
<img src="http://www.fillmurray.com/800/402" class="img-responsive">
</div>
</li>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner" role="listbox">
<div class="item active">
<img src="http://www.fillmurray.com/800/400" width="800" height="400">
<div class="carousel-caption">
Slide 1
</div>
</div>
<div class="item">
<img src="http://www.fillmurray.com/800/401" width="800" height="400">
<div class="carousel-caption">
Slide 2
</div>
</div>
<div class="item">
<img src="http://www.fillmurray.com/800/402" width="800" height="400">
<div class="carousel-caption">
Slide 3
</div>
</div>
</div>
<!-- Controls -->
<a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
</div>
</div>
</div>

Pictures not centered in carousel

I made a carousel using twitter-bootstrap, and it shows a couple pictures. Problem is, all of the pictures are different sizes and, right now, they aren't centered. Is there a way that the carousel can re-size to center each picture horizontally and vertically whenever the picture in question changes?
Here is code so far:
<div class="modal-body">
<div id="picture-carousel" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#picture-carousel" data-slide-to="0" class="active"></li>
<li data-target="#picture-carousel" data-slide-to="1"></li>
<li data-target="#picture-carousel" data-slide-to="2"></li>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner">
<div class="item active">
<img src="/images/picture-1.jpg" alt="" />
<div class="carousel-caption">
<p></p>
</div>
</div>
<div class="item">
<img src="/images/picture-2.jpg" alt="" />
<div class="carousel-caption">
<p></p>
</div>
</div>
<div class="item">
<img src="/images/picture-3.jpg" alt="" />
<div class="carousel-caption">
<p></p>
</div>
</div>
</div>
<!-- Controls -->
<a class="left carousel-control" href="#picture-carousel" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
</a>
<a class="right carousel-control" href="#picture-carousel" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
</a>
</div> <!--Carousel-->
</div> <!--modal-body-->
Thanks for any and all tips!
Use this Style to center images :-
div.carousel-inner img{
margin: 0 auto;
}

Resources