CSS image-background of child element showing above image-border - html

I have the following markup:
<div id="carousel-is-sl-for-me" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#carousel-is-sl-for-me" data-slide-to="0" class="active">
<li data-target="#carousel-is-sl-for-me" data-slide-to="1">
<li data-target="#carousel-is-sl-for-me" data-slide-to="2">
<li data-target="#carousel-is-sl-for-me" data-slide-to="3">
<li data-target="#carousel-is-sl-for-me" data-slide-to="4">
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner" role="listbox">
<div class="item active" style="background-image: url('<?php bloginfo('template_url'); ?>/image/carousel-placeholder-01.jpg');">
<div class="container">
<div class="row">
<div class="col-md-5 col-md-offset-1">
<div class="panel panel-info">
<div class="panel-heading">1 in 4 people</div>
<div class="panel-body">
<p>...text goes here</p>
<a href="#" class="btn btn-primary">
<span class="glyphicon glyphicon-file"></span>
Download PDF
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Controls -->
<a class="left carousel-control" href="#carousel-is-sl-for-me" 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-is-sl-for-me" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
Notice how .item has a background applied to it as an inline style.
Then, in my CSS I have the following CSS border:
#carousel-is-sl-for-me {
border-image-slice: 15 27 15 27;
border-image-width: 15px 15px 15px 15px;
border-image-repeat: repeat repeat;
border-image-source: url('../image/marker-border-image-white-big-reversed.png');
border-style: solid;
}
However, the image background of the .item is hiding the image border of #carousel-is-sl-for-me:
Seeing as #carousel-is-sl-for-me is the parent element, I would have thought it's image borders would have been on top? Here is how they should look (if I hide the image background):
Is there an easy way to get around this?

Related

Bootstrap Carousel's background not equal

I have a problem with Bootstrap Carousel with my two backgrounds.
#Carousel-purpose {
background-color:#856c8b;
text-align: center;
color: #fff;
}
.carousel-inner {
padding: 7% 15%;
}
<section id="Carousel-purpose">
<div id="Carousel" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#Carousel-purpose" data-slide-to="0" class="active"></li>
<li data-target="#Carousel-purpose" data-slide-to="1"></li>
</ol>
<div class="carousel-inner">
<div class="carousel-item active" data-interval="3000">
<h3>Szyjemy maski dla najbardziej potrzebujących oraz domów opieki.</h3>
<img src="images/hospital.png" width="100px" height="100px">
</div>
<div class="carousel-item" data-interval="3000">
<h3>Wypełnij ankietę, by pomóc nam dostarczyć maski dla potrzebujących!</h3>
<button type="button" class="btn btn-outline-light btn-lg ">Light</button>
</div>
</div>
<a class="carousel-control-prev" href="#Carousel-purpose" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#Carousel-purpose" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
</section>
Why are they not equal? I've attached image below for better explanation. Probably the issue is in CSS but honestly I don't know where, could someone help?
instead of using,
<img src="images/hospital.png" width="100px" height="100px">
try,
<img src="images/hospital.png" style=" width:100px; height: 100px !important;">
use the same to the second background image.

bootstrap Carousel questions

1) I use the carousel-thumbnails class. Somehow my thumbnails all align to the left side and on top of each other. How can I get them to align center one after another.
2)
I don't want to see the dots that indicate which photo is showing because I have the thumbnails, How can I get rid of them?
I just want to show 5 thumbnails although there are more photo's in my directory. How can I program it that as soon as I go to photo 4 he loads photo 6 and display in the thumbnails photo 2-6.
I tried hidden-xs in the class="carousel-indicators". That didn't work. But I think when it works it will also remove my thumbnails.
<div id="myCarousel" class="carousel slide carousel-thumbnails" data-ride="carousel">
<!-- Wrapper for slides -->
<div class="carousel-inner"role="listbox">
<div class="item active">
<img src="/fotos/auto.jpg" alt="Los Angeles" style="width:80%;">
<div class="carousel-caption">
<h3>test</h3>
<p>Info tekst</p>
</div>
</div>
<div class="item">
<img src="/fotos/visinstukjes.jpg" alt="vis" style="width:80%;">
<div class="carousel-caption">
<h3>Vis</h3>
<p>In stukjes of zoiets</p>
</div>
</div>
<div class="item">
<img src="/fotos/robot.jpg" alt="Chicago" style="width:80%;">
</div>
<div class="item">
<img src="/fotos/vrachtwagen.jpg" alt="New york" style="width:80%;">
</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>
<!--/.Controls-->
<ol class="carousel-indicators" >
<li data-target="#carousel-thumb" data-slide-to="0" class="active">
<img src="/fotos/auto.jpg" width="100">
</li>
<li data-target="#carousel-thumb" data-slide-to="1">
<img src="/fotos/visinstukjes.jpg" width="100">
</li>
<li data-target="#carousel-thumb" data-slide-to="2">
<img src="/fotos/robot.jpg" width="100">
</li>
<li data-target="#carousel-thumb" data-slide-to="2">
<img src="/fotos/vrachtwagen.jpg" width="100">
</li>
</ol>
</div>
use this code:
.mystyle{
background-image: url('bg.png');
width: 100px !important;
height: 100px !important;
background-position: center;
background-size: 100%;
background-repeat: no-repeat;
}
<div id="myCarousel" class="carousel slide carousel-thumbnails" data-ride="carousel">
<!-- Wrapper for slides -->
<div class="carousel-inner"role="listbox">
<div class="item active">
<img src="bg.png" alt="Los Angeles" style="width:80%;margin:0 auto">
<div class="carousel-caption">
<h3>test</h3>
<p>Info tekst</p>
</div>
</div>
<div class="item">
<img src="bg.png" alt="vis" style="width:80%;;margin:0 auto">
<div class="carousel-caption">
<h3>Vis</h3>
<p>In stukjes of zoiets</p>
</div>
</div>
<div class="item">
<img src="bg.png" alt="Chicago" style="width:80%;;margin:0 auto">
</div>
<div class="item">
<img src="bg.png" alt="New york" style="width:80%;;margin:0 auto">
</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>
<!--/.Controls-->
<ol class="carousel-indicators" >
<li data-target="#carousel-thumb" data-slide-to="0" class="active mystyle"></li>
<li data-target="#carousel-thumb" data-slide-to="1" class="mystyle"></li>
<li data-target="#carousel-thumb" data-slide-to="2" class="mystyle"></li>
<li data-target="#carousel-thumb" data-slide-to="2" class="mystyle"></li>
</ol>
</div>

Slider inside image - CSS

I am trying to create slider inside an image.
As to the attachment, I want to change the proportion of the background color and then to insert inside this div the slider.
I was using this example:
Fiddle here
The code:
HTML
<div class="col-6 col-md-4">
<img class="temp" src="img/phone.png">
<div class="bg-image">
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
<li data-target="#carousel-example-generic" data-slide-to="1"></li>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner" role="listbox">
<div class="item active">
<img src="./img/testimonial-bg.jpg" alt="...">
</div>
<div class="item">
<img src="http://www.freedomwallpaper.com/nature-wallpaper/nature-hd-wallpapers-water.jpg" alt="...">
</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>
CSS
#application img {
width: 250px;
height: 375px;
position: absolute;
}
.temp {
background: #440;
}
/*Image slider */
.bg-image {
width:250px;
height:350px;
background-repeat:no-repeat;
background-size:100%;
position: relative;
padding: 150px 0 0 0;
z-index: 1;
}
.carousel-inner>.item>a>img,
.carousel-inner>.item>img{
height: 350px;
}
Thank you for your help.

Why does my bootstrap carousel have extra space on the sides?

I'm fairly certain that this is a simple fix, but I've spent hours on it and am not sure why I haven't been able to fix it. Any help would be greatly appreciated!
My HTML is standard bootstrap:
<div class="row">
<div class="container" id="main">
<div class=col-md-12>
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel" data-interval="5000">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
<li data-target="#carousel-example-generic" data-slide-to="1"></li>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner" role="listbox">
<div class="item active">
<img src="*IMAGE*" alt="Power Grid">
<div class="carousel-caption">
<h3>HELLO</h3>
<p>World</p>
</div>
</div>
<div class="item">
<img src="*IMAGE*" alt="Power Grid">
<div class="carousel-caption">
<h3>GOODBYE</h3>
<p>World</p>
</div>
</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>
Here is my current CSS:
#main.container {
padding: 0 10% 5% 10%;
}
.carousel-inner > .item > img,
.carousel-inner > .item > a > img {
width: 50%;
margin: auto;
}
#carousel-example-generic {
border: #000000 solid 10px;
border-radius: 15px;
}

Glyphicon instead of carousel indicators

I'm trying to replace bootstrap indicators circles with some glyphicons.
I tried to add glyphicon to carousel indicator, but not working.
http://jsfiddle.net/bn6aA/57/
HTML
<div id="locations" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators glyphicon glyphicon-refresh">
<li data-target="#locations" data-slide-to="0" class="active"></li>
<li data-target="#locations" data-slide-to="1"></li>
<li data-target="#locations" data-slide-to="2"></li>
<li data-target="#locations" data-slide-to="3"></li>
</ol>
<div class="carousel-inner">
<div class="item active ">
<img src="http://www.keenthemes.com/preview/metronic/theme/assets/global/plugins/jcrop/demos/demo_files/image1.jpg" alt="">
</div>
<div class="item">
<img src="http://www.keenthemes.com/preview/metronic/theme/assets/global/plugins/jcrop/demos/demo_files/image1.jpg" alt="">
</div>
<div class="item">
<img src="http://www.keenthemes.com/preview/metronic/theme/assets/global/plugins/jcrop/demos/demo_files/image1.jpg" alt="">
</div>
<div class="item">
<img src="http://www.keenthemes.com/preview/metronic/theme/assets/global/plugins/jcrop/demos/demo_files/image1.jpg" alt="">
</div>
</div>
<a class="left carousel-control" href="#locations" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
</a>
<a class="right carousel-control" href="#locations" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
</a>
</div>
Using glyphicons as carousel indicators is not such easy thing to do because we must do some modifications.I removed the class carousel-indicators from the list, i put the glyphicons inside the custom-list list items, and used my custom-list class to style the glyphicons.Also i removed the imported bootstrap-combined library because it was messing up the left and right carousel controls.
The above approach has one negative side which is we cannot style the glyphicon coresponding to the current active slide because we removed the carousel-indicators class from the list.
.custom-list li {
display: inline;
font-size: 40px;
color: #fff;
}
.custom-list li:hover {
color: #888;
cursor: pointer;
}
.item img {
width: 100%;
}
.custom-list {
top: 15px;
margin: auto;
position: absolute;
width: 50%;
top: 0;
left: 0;
bottom: 0;
right: 0;
text-align: center;
right: 15px;
z-index: 1;
list-style: none;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" />
<div id="locations" class="carousel slide" data-ride="carousel">
<ol class="custom-list">
<li data-target="#locations" data-slide-to="0" class="active"><span class="glyphicon glyphicon-th-large"></span>
</li>
<li data-target="#locations" data-slide-to="1"><span class="glyphicon glyphicon-th"></span>
</li>
<li data-target="#locations" data-slide-to="2"><span class="glyphicon glyphicon-th-list"></span>
</li>
<li data-target="#locations" data-slide-to="3"><span class="glyphicon glyphicon-list"></span>
</li>
</ol>
<div class="carousel-inner">
<div class="item active ">
<img src="http://placehold.it/900x200?text=First slide" alt="">
</div>
<div class="item">
<img src="http://placehold.it/900x200?text=Second slide" alt="">
</div>
<div class="item">
<img src="http://placehold.it/900x200?text=Third slide" alt="">
</div>
<div class="item">
<img src="http://placehold.it/900x200?text=Fourth slide" alt="">
</div>
</div>
<a class="left carousel-control" href="#locations" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
</a>
<a class="right carousel-control" href="#locations" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
</a>
</div>
Straight from the bootstrap website (http://getbootstrap.com/javascript/#carousel):
<!-- 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>
However, something is going a little wonky here, so remove the circles like this with CSS
.carousel-control {
background: none !important;
border: none;
}
Proof: http://jsfiddle.net/bn6aA/65/
As you can see, this is still not rendering exactly correct. Some things are out of place and sized too big etc... This is because you are using bootstrap-combined.min.css V2.3.1 and bootstrap.css V3.0.0
Removing bootstrap-combined.min.css results in a much better looking solution: http://jsfiddle.net/bn6aA/64/