Bootstrap carousel is filling my whole page - html

I would like a carousel that fills about half of the window. I've been reading through the documentation https://getbootstrap.com/docs/4.1/components/carousel/ and a following a youtube tutorial for help https://youtu.be/9cKsq14Kfsw?t=3510. My images fill the entire page plus more (when scrolled down) and I can't figure out how to make it smaller other than setting a fixed height in CSS which makes the image look squashed.
Here is my code
html, body {
width: 100%;
height: 100%;
}
.carousel-inner img {
width: 100%;
height: 100%;
}
<!-- Image carousel -->
<div id="slides" class="carousel slide" data-ride="carousel">
<!-- Carousel images -->
<div class="carousel-inner">
<div class="carousel-item active">
<img src="img/home-1.png" />
<div class="carousel-caption">
<h1 class="display-2">Garnet Home Inspections</h1>
</div>
</div>
<div class="carousel-item">
<img src="img/home-2.png" />
<div class="carousel-caption">
<h1 class="display-3">Service Area</h1>
<h3>I travel all over the capital Region</h3>
<button type="button" class="btn btn-outline-light btn-lg">SET UP AN APPOINTMENT</button>
</div>
</div>
<div class="carousel-item">
<img src="img/home-3.png" />
<div class="carousel-caption">
<!-- put content here -->
</div>
</div>
</div>
<!-- Carousel buttons-->
<a class="carousel-control-prev" href="#slides" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span> <!-- Screenreaders only -->
</a>
<a class="carousel-control-next" href="#slides" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span> <!-- Screenreaders only -->
</a>
</div>
Thank you in advance :)
If anyone needs more information/code please let me know.

Related

Rescale Bootstrap columns to be the same height as another column?

So I have been having to struggle with this for quite a while, I am not sure how to resize the carousel so that it matches the column height of the blockquote and I can't seem to centre the image div inside the carousel. If I have a large image, the carousel becomes taller than the text.
I would like image1 to be scaled to the same height as image2 whilst also keeping the same aspect ratio.
Here is my code:
Best to view it fullscreen.
.project {
background-color: lightblue;
}
.image1 {
height: 500px;
width: 350px;
background-color: #3178bf;
}
.image2 {
height: 300px;
width: 200px;
background-color: #3178bf;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet" />
<div class="project">
<div class="row align-items-center">
<div class="col-sm-7">
<blockquote class="blockquote text-left description">
<h3 style="margin-left: 30px; margin-top: 10px;">
Title
</h3>
<ul>
<li>
Text goes here
</li>
<li>
Text goes here
<br> Text goes here
<br> Text goes here
<br> Text goes here
<br> Text goes here
<br> Text goes here
<br> Text goes here
<br> Text goes here
<br> Text goes here
<br> Text goes here
</li>
</ul>
<footer class="blockquote-footer">
Date
</footer>
</blockquote>
</div>
<div class="col">
<div id="carousel4" class="carousel slide" data-interval="false">
<ol class="carousel-indicators">
<li data-target="#carousel4" data-slide-to="0" class="active"></li>
<li data-target="#carousel4" data-slide-to="1"></li>
</ol>
<div class="carousel-inner">
<div class="carousel-item active">
<div class="image1" alt="Test image">
</div>
</div>
</div>
<a class="carousel-control-prev" href="#carousel4" 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="#carousel4" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
</div>
</div>
</div>

I can't get my text to display under my carousel

I'm trying to learn bootstrap 4 and I'm struggling to get my h2 text to display under the carousel.
<a class="carousel-control-next" href="#slides" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</div>
<!--------->
<div class="container-fluid padding">
<div class="row text-center">
<div class="col-12">
<h2 class="display-4">
*text*
</h2>
</div>
</div>
</div>
only relevant css
.carousel-inner> #imageSize{
height: 450px;
width: 100%;
}
You need to add height to the container-fluid class
.container-fluid{
height: 10rem;
}
View jsFiddle link to see the implementation https://jsfiddle.net/ykxt4qzd/

How can I make a Bootstrap carousel caption stretch the full width of the carousel?

I have a carousel that's the full width of the page. Now I need to make the carousel-caption the full width of the page as well with a yellow background. The background should be the full width of the page, but the actual caption text should be centered.
This is what it should look like:
This is what it looks like now:
HTML:
<!--START CAROUSEL-->
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel" data-interval="false">
<!-- Wrapper for slides -->
<div class="carousel-inner" role="listbox">
<div class="item active">
<img src="../../images/LD/desktop_hero1.png" alt="...">
<div class="carousel-caption">
Text for caption 1 here.
</div>
</div>
<div class="item">
<img src="../../images/LD/desktop_hero2.png" alt="...">
<div class="carousel-caption">
Text for caption 2 here.
</div>
</div>
<div class="item">
<img src="../../images/LD/desktop_hero3.png" alt="...">
<div class="carousel-caption">
Text for caption 3 here.
</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>
<!--END CAROUSEL-->
CSS:
<style type="text/css">
.carousel-caption {
max-width: 100%;
width:100%;
background-color: #ffb81c;
}
</style>
carousel-caption class declares the div to have an absolute positioning with its position to be 15 % from left.
So you can try to override that. Here is the css:
.carousel-caption {
max-width: 100%;
width:100%;
background-color: #ffb81c;
left: 0;
}
you only need to add text-align: center becaus actually it uses the full width already
if something is floating u can use a clearfix to solve it, check this jsfidlle
title example
<div class="carousel-caption">
<h1>
Text for caption 1 here.
</h1>
</div>
.carousel-caption h1 {
max-width: 100%;
background-color: #ffb81c;
text-align:center;
}
pd. i added the h1 tag to have a better semantic structure.

Bootstrap image carousel, with text to the right

Okay, so I'm trying to get a webpage to show a Bootstrap image carousel, which works! But I want some text to the right of it. I'm not trying to get the text to change with the image, just be to the side.
Here is the HTML for the page;
http://pastebin.com/EabGfv3H#
And here is the custom CSS I'm using;
http://pastebin.com/MEtF1hTR
And a JSFiddle;
http://jsfiddle.net/swfour/52VtD/3942/
Needed code for JSFiddle link, so here is the html;
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<div id="carousel" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#carousel" data-slide-to="0" class="active"></li>
<li data-target="#carousel" data-slide-to="1"></li>
<li data-target="#carousel" data-slide-to="2"></li>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner" role="listbox">
<div class="item active">
<img src="images/Beaches and Villages\Golden Beach umbrellas home.JPG" alt="...">
<div class="carousel-caption">
Golden Beach
</div>
</div>
<div class="item">
<img src="images/Beaches and Villages\Limenas ancient city.jpg" alt="...">
<div class="carousel-caption">
Limenas
</div>
</div>
<div class="item">
<img src="images/Beaches and Villages\Potos sunset.JPG" alt="...">
<div class="carousel-caption">
Potos
</div>
</div>
</div>
<!-- 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>
</div>
<div id="carousel_text" class="col-md-6">
<div>
<p>
Thasos, an island surrounded by the crystal-clear emerald waters of the Aegean Sea is part of the Northeastern islands of
Greece, also being the closest one to the continent. It is the perfect getaway for holidays during summer, a place where
you can relax and enjoy your holidays, forget about all your worries on a quiet sandy beach, but also a place where you
can explore the Greek way of life, try the best foods and meet the most amazing people.
</p>
</div>
</div>
</div>
I've tried not using the bootstrap columns and just using float left and right, which didn't work.
From your image mockup, I assume you need the carousel on some 75% width while the other text/div on remaining 25% width within your main container. OR the text/div should be outside of carousel.
So if that's the case, try using this -
add a new class carousel-left to <div id="carousel-example-generic" class="carousel slide carousel-left" data-ride="carousel">
add/update your text-div in html as shown below:
<div class="bs-example" data-example-id="simple-carousel">
<div id="carousel-example-generic" class="carousel slide carousel-left" data-ride="carousel">...</div>
<div class="some-text">your text div</div>
</div>
add following in your css -
.carousel-left { width: 75%; float: left; }
.some-text { float: left; width: 25%; }
Hope it helps.
I add pull-left class to img, and add pull-right class to your text and place it inside <span> not <div> and remove carousel-caption from it.seems to work Pluncker
<div class="item">
<img class="pull-left" src="images/Beaches and Villages\Limenas ancient city.jpg" alt="...">
<span class="pull-right">
Limenas
</span>
</div>

Making back image blur and front image clearly visible

I was working with carosel in bootstrap and I want background image to be blur and top image to be properly visible. For this I was using two classes in style but as a result both front and back images are coming blur. The fiddle for the same is here https://jsfiddle.net/v37wju8h/6/ . Please increase the screen size to check the problem with the result. Below is the code -
<div class="container">
<div id="carousel" class="carousel slide" data-ride="carousel">
<div class="carousel-inner"> <!-- Wrapper for slides -->
<div class="item active back_img" style="background-image:url('http://www.pluots.net/media/full/18/dining-table-contemporary-in-wood-home-fred-by-vladimir-dining-table-contemporary-in-wood-home-fred-by-vladimir.jpg');">
<img class="front_img" src="http://www.pluots.net/media/full/18/furniture-tips-to-make-marvellous-round-dining-table-furniture-tips-to-make-marvellous-round-dining-table.jpg"/>
<div class="carousel-caption">
<h3>Image1</h3>
</div>
</div>
<div class="item back_img" style="background-image:url('http://www.pluots.net/media/full/18/dining-table-contemporary-in-wood-home-fred-by-vladimir-dining-table-contemporary-in-wood-home-fred-by-vladimir.jpg');">
<img class="front_img" src="http://www.pluots.net/media/full/18/furniture-tips-to-make-marvellous-round-dining-table-furniture-tips-to-make-marvellous-round-dining-table.jpg" />
<div class="carousel-caption">
<h3>Image2 </h3>
</div>
</div>
<div class="item back_img" style="background-image:url('http://www.pluots.net/media/full/18/dining-table-contemporary-in-wood-home-fred-by-vladimir-dining-table-contemporary-in-wood-home-fred-by-vladimir.jpg');">
<img class="front_img" src="http://www.pluots.net/media/full/18/furniture-tips-to-make-marvellous-round-dining-table-furniture-tips-to-make-marvellous-round-dining-table.jpg" />
<div class="carousel-caption">
<h3>Image 3</h3>
</div>
</div>
</div>
<!-- Controls -->
<a class="left carousel-control" href="#carousel" role="button" data-slide="prev"><span class="glyphicon glyphicon-chevron-left"></span></a>
<a class="right carousel-control" href="#carousel" role="button" data-slide="next"><span class="glyphicon glyphicon-chevron-right"></span></a>
</div>
</div>
You can use opacity
opacity: 0.5
position: relative;