How to make images fit carousel containers? - css

I am trying to make all the images of different heights and widths within the carousel the same height matching the size of the carousel container '.carouselWrapper'
https://codepen.io/SashaSashaSasha/pen/MWgepEe
HTML
<div class="carouselWrapper">
<div class="carousel">
<div><img src="https://trendland.com/wp-content/uploads/2019/01/Myles_Pedlar_3.jpg"></div>
<div><img src="https://1aike31wshtt3k0e9u2nxtwz-wpengine.netdna-ssl.com/wp-content/uploads/2019/01/Myles_Pedlar_13-770x1090.jpg"></div>
<div><img src="https://trendland.com/wp-content/uploads/2019/01/Myles_Pedlar_3.jpg"></div>
<div><img src="https://1aike31wshtt3k0e9u2nxtwz-wpengine.netdna-ssl.com/wp-content/uploads/2019/01/Myles_Pedlar_13-770x1090.jpg"></div>
</div>
</div>
CSS
img {
max-width:100%;
max-height:100%;
margin: auto;
}
.carouselWrapper {
margin: 0px;
height: 80vh;
width: 100
}
.carousel{
width: 100%;
height: 100%;
margin:0px auto;
}
.slick-slide{
margin: 10px;
}
.slick-slide img{
width: 100%;
}

Try to see this example. Hoping this is what you're looking for. All the best!
.carousel-inner .item{ height:500px; background-size:cover;background-position: center center;}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<div class="container">
<br>
<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>
<li data-target="#myCarousel" data-slide-to="3"></li>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner" role="listbox">
<div class="item active" style="background-image: url(//placehold.it/1024x700) ">
</div>
<div class="item" style="background-image: url(//placehold.it/100x100) ">
</div>
<div class="item" style="background-image: url(//placehold.it/1024x700) ">
</div>
<div class="item" style="background-image: url(//placehold.it/200x200) ">
</div>
</div>
<!-- Left and right controls -->
<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>
</div>
<script type='text/javascript' src="//ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script type='text/javascript' src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

Add this code in your css.
.slick-list, .slick-track {
height: 100%;
}
.slick-slide img{
width: fit-content;
}

See if this what you want, I'm just inherit the img in "carousel div" and set the div with 100%
.carousel{ max-height:100%; overflow:hidden;}
.carousel div { width:100%; height: 100%; }
.carousel div img {
max-width:100% ;
max-height:100%;
width:auto;
margin: auto;
}
.carouselWrapper {
margin: 0px;
height: 80vh;
width: 100
}
.carousel{
width: 100%;
height: 100%;
margin:0px auto;
}
this was the result

Related

Height of images used within carousel is not relating to the div used to hold the carousel

.mainIDv
{
height:300px;
width:400px;
padding:5px;
margin: 8px auto 8px auto;
}
.ImgDisp{
background-color:cyan;
height:100%;
width:100%;
}
.carousel-inner > .carousel-item > img {
width: 100% !important;
height: 100% !important;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
<div class="mainIDv">
<div class="ImgDisp">
<div id="carouselSection" class="carousel slide" data-ride="carousel">
<ul class="carousel-indicators">
<li data-target="#carouselSection" data-slide-to="0"></li>
<li data-target="#carouselSection" data-slide-to="1"></li>
<li data-target="#carouselSection" data-slide-to="2"></li>
</ul>
<div class="carousel-inner">
<div class="carousel-item active">
<img src="https://upload.wikimedia.org/wikipedia/commons/f/f9/Phoenicopterus_ruber_in_S%C3%A3o_Paulo_Zoo.jpg" alt="Los Angeles" >
<div class="carousel-caption">
<h3>Tomorrow land </h3>
<p>We had good friends here!</p>
</div>
</div>
<div class="carousel-item">
<img src="https://upload.wikimedia.org/wikipedia/commons/f/f9/Phoenicopterus_ruber_in_S%C3%A3o_Paulo_Zoo.jpg" alt="Chicago" style="width: 100%; height: 100%;">
<div class="carousel-caption">
<h3>HappyLand</h3>
<p>Thank you!</p>
</div>
</div>
</div>
<a class="carousel-control-prev" href="#demo" data-slide="prev">
<span class="carousel-control-prev-icon"></span>
</a>
<a class="carousel-control-next" href="#demo" data-slide="next">
<span class="carousel-control-next-icon"></span>
</a>
</div>
</div>
</div>
I tried to create a slide show using carousel of bootstrap 4. I used the carousel code section within a div block. But my problem is height of images used within the carousel is not matching with the height of the div holding it. I tired every solutions suggested here, but none works for me.
here is my code.
<div class="ImgDisp">
<div id="demo" class="carousel slide" data-ride="carousel">
<ul class="carousel-indicators">
<li data-target="#demo" data-slide-to="0" class="active"></li>
<li data-target="#demo" data-slide-to="1"></li>
<li data-target="#demo" data-slide-to="2"></li>
</ul>
<div class="carousel-inner">
<div class="carousel-item active">
<img src="Images/Img12.png" alt="Los Angeles" >
<div class="carousel-caption">
<h3>Tomorrow land </h3>
<p>We had good friends here!</p>
</div>
</div>
<div class="carousel-item">
<img src="Images/Img4.jpg" alt="Chicago" style="width: 100%; height: 100%;">
<div class="carousel-caption">
<h3>HappyLand</h3>
<p>Thank you!</p>
</div>
</div>
</div>
<a class="carousel-control-prev" href="#demo" data-slide="prev">
<span class="carousel-control-prev-icon"></span>
</a>
<a class="carousel-control-next" href="#demo" data-slide="next">
<span class="carousel-control-next-icon"></span>
</a>
</div>
</div>
I want images with height and width 100% matching with the div ImgDisp.
I tired overriding the styles defined for components like carousel, carousel-inner, carousel-item. but only width is working for me. Even tried to change the image styles.
.carousel-inner > .carousel-item > img {
width: 100% !important;
height: 100% !important;
}
I don't know why, somebody suggest a solutions. Thanks in advance.
you are overriding your img height by 10% in this style
.carousel-inner > .carousel-item > img {
width: 100% !important;
height: 10% !important;
}
change it to 100%.

Bootstrap carousel with background

My client has bootstrap template. I made a slider there:
Slider
Images are mooving only in laptop. I want to add description to the right side of the laptop (Now sliding description does not work). And have no idea how to do it. Tried many variations.
Or better and faster just to write slider myself, not using Bootstrap?
Will be greatful for any help!
html:
<!-- 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="images/people.png" alt="">
</div>
<div class="item">
<img src="images/people.png" alt="">
</div>
<div class="item">
<img src="images/people.png" alt="">
</div>
</div>
<div class="carousel-description current">
<div>Отчёт по результатам обследования в форме документа в PS QUASTIO PRO</div>
</div>
<div class="carousel-description">
<div>Отчёт по результатам обследования в форме документа</div>
</div>
<div class="carousel-description">
<div>Отчёт по результатам обследования</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>
CSS:
#myCarousel{
height: 510px;
background: url(../images/computer.png) no-repeat;
background-size: 1350px auto;
}
#myCarousel .carousel-inner{
width: 441px;
height: 250px;
position: absolute;
left: 225px;
top: 24px;
}
.carousel {
margin-bottom: 0;
}
#myCarousel .carousel-inner .item img{
width: 441px;
height: 250px;
}
.carousel-description{
display: none;
width: 25%;
position: absolute;
right: 150px;
top: 185px;
font-size: 20px;
}
.carousel-description.current{
display: block;
}
You can use my code which doesnt use any library and is similar to the pic you attached ,just change the pics path from css.
you can control the speed of slides from changing variable yourinterval
var yourinterval=2000;
DEMO:http://jsbin.com/xegufazuyi/2/edit?html,css,js,output

Made carrousel responsive in all devices

I can't fix my carousel images for any devices. Here is my code:
div.c-wrapper {
height: 406px;
width: 940px;
/* use this, or not */
margin: auto;
}
.img-responsive {
max-width: 100%;
display: block;
height: auto;
}
<div class="container">
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<div class="c-wrapper">
<div id="carousel-example-generic" class="carousel slide">
<!-- 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>
<li data-target="#carousel-example-generic" data-slide-to="2"></li>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner">
<div class="item active">
<img src="Images/carrousel11.jpg" class="img-responsive" alt="">
</div>
<div class="item">
<img src="Images/carrousel5.jpg" class="img-responsive" alt="">
</div>
<div class="item">
<img src="Images/carrousel6.jpg" class="img-responsive" alt="">
</div>
</div>
<!-- Controls -->
<a class="left carousel-control" href="#carousel-example-generic" data-slide="prev">
<span class="icon-prev"></span>
</a>
<a class="right carousel-control" href="#carousel-example-generic" data-slide="next">
<span class="icon-next"></span>
</a>
</div>
</div>
</div>
</div>
Thank you guys if can help me out!
Even though I'd highly recommend using a library like Slick, the exercise of creating a slider from scratch is a worth while one to consider, if for no other reason than to better understand web technologies.
Here are a few things to consider. In order to make a proper carousel you'll want to use JavaScript to manage the click events for next, previous and clicking on the indicators. You had a number of issues with your mark up and CSS that I've done my best to match what I believe was your original intention but if anything is off let me know and we can refine from here.
Hide the inactive image
In order to give the appearance of sliding you need to hide all but the one active slides. Then on click you simply hide the active item by remove the .active class then add that class to the next element - in this case by stepping through your data-slide-to attribute.
Positioning
The best way that I've found to position your previous and next buttons is to use position: absolute. In order for this to work you need to have a relatively positioned container around it. I did this on .carousel.
Extraneous markup
I didn't remove all of the unneccessary markup but you'll find that several of the divs in your example are not neccessary especially at the top level. I left those in just in case you had some other reason for that.
Images
Quick tip, if you're going to use relative images in your SO posts, try to swap those for Placehold.it images as they won't render on SO.
.carousel-wrapper {
width: 500px;
margin: auto;
}
.carousel-wrapper:after {
content: "";
display: table;
clear: both;
}
.carousel {
position: relative;
}
.left, .right {
position: absolute;
top: 50%;
}
.left {
left: -50px;
}
.right {
right: -50px;
}
.img-responsive {
max-width: 100%;
display: block;
}
.carousel-indicators {
display: block;
height: auto;
padding: 0;
margin: 0;
text-align: center;
}
.carousel-indicators li {
width: 15px;
height: 15px;
background: #ccc;
margin: 0 5px;
display: inline-block;
list-style: none;
border-radius: 50%;
}
.item {
display: none;
}
.active {
display: block;
}
<div class="container">
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<div class="carousel-wrapper">
<div id="carousel-example-generic" class="carousel slide">
<!-- 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>
<li data-target="#carousel-example-generic" data-slide-to="2"></li>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner">
<img src="https://placehold.it/500x250" class="item active img-responsive" alt="">
<img src="https://placehold.it/500x250" class="item img-responsive" alt="">
<img src="https://placehold.it/500x250" class="item img-responsive" alt="">
</div>
<!-- Controls -->
<a class="left carousel-control" href="#carousel-example-generic" data-slide="prev">
<span class="icon-prev">Prev</span>
</a>
<a class="right carousel-control" href="#carousel-example-generic" data-slide="next">
<span class="icon-next">Next</span>
</a>
</div>
</div>
</div>
</div>

Putting Bootstrap Carousel indicator vertically at the right of the Carousel

I am trying to change the Bootstrap Carousel indicator align to vertical and locate them in the right of the page.
As you can see at following demo (the demo is on Bootply, I am not sure why the indicators are still looks like horizontal at JS Fiddle).
Working Demo
As you can see from the demo I have set the right: 5%; on .carousel-indicators but thy are rendering almost at the middle of the Carousel! What am I doing wrong?
.carousel-indicators {
background-color:#000;
position: absolute;
bottom: 200px;
z-index: 15;
width: 30px;
margin-left: 20px;
list-style: none;
text-align: center;
right: 5%;
}
.carousel-indicators li{
display: block;
width: 10px;
height: 10px;
margin-bottom: 10px;
}
.carousel-indicators .active {
width: 12px;
height: 12px;
margin-bottom: 10px;
background-color: #fff;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<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>
<li data-target="#carousel-example-generic" data-slide-to="2"></li>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner" role="listbox">
<div class="item active">
<img src="http://placehold.it/1920x400/333/333" alt="...">
<div class="carousel-caption">
...
</div>
</div>
<div class="item">
<img src="http://placehold.it/1920x400/333333/333333" alt="...">
<div class="carousel-caption">
...
</div>
</div>
<div class="item">
<img src="http://placehold.it/1920x400/333/333" alt="...">
<div class="carousel-caption">
...
</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>
Left component is set to 50% in bootstrap css. you need to overrride it.
give your indicators left 95% that should fix your problem.
left:95%
set left:inherit because the lib has a default setting you must override.

Showing full height image on every browsers

I'd like to show an image, full height image, like this website on every browsers without writing specific number of pixels like height: 400px;.
mobile
laptop
How should I change my css? Would you please let me know?
html {
font-size: 62.5% !important; /* 10 px */
}
/*header {
position: absolute;
text-align: center;
top: 0px;
z-index: 1000;
color: #fff;
width: 100%;
height: 64px;
border-bottom: 1px solid rgba(0, 0, 0, 0.07);
}*/
/*img {
display: block;
max-width: 100%;
height: auto;
}*/
.carousel-control.left, .carousel-control.right {
background: none !important;
filter: progid: none !important;
outline: 0;
}
.carousel .carousel-control {
visibility: hidden;
}
.carousel:hover .carousel-control {
visibility: visible;
}
.carousel-indicators {
bottom:-50px;
}
.carousel-inner {
margin-bottom:50px;
}
/*.logo {
float: left;
text-align: left;
display: inline-block;
}*/
.transparent-header {
z-index: 22;
position: absolute;
width: 100%;
left: 0;
background-color: rgba(255, 255, 255, 0.9);
border-bottom: 1px solid rgba(0, 0, 0, 0.07);
}
#carousel-example-generic {
width: 100%;
height: 100%;
position: relative;
}
.nav::after,
.nav::before,
.navbar-header::after,
.navbar::after {
display: table-caption;
}
.nav.navbar-nav li,
.nav.navbar-nav li a {
display: inline-block;
}
#gnav {
font-size: 0.9em;
width: 100% !important;
}
#gnav
/*#gnav_nav*/ {
text-align: center;
}
#logo
img {
display: block;
margin: auto;
}
#intro {
position: relative;
overflow: hidden;
}
#bg-image3 {
background: url("http://htmlcoder.me/preview/the_project/v.1.3/template/images/slider-fullscreen-slide-1.jpg");
}
.bg-image {
background-position: center;
background-repeat: no-repeat;
background-size: cover;
display: block;
overflow: hidden;
position: relative;
width: 100%;
height: 100%;
}
<!DOCTYPE html>
<html lang="en-EN">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <!-- for IE -->
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
<title>{% block title %}{% endblock %}</title>
<meta name=”robots” content=”noindex,nofollow,noarchive,noodp,noydir”>
<!-- <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jquerymobile/1.4.5/jquery.mobile.min.css"> -->
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="{% static 'font-awesome/css/font-awesome.min.css' %}" />
{% block additional_css %}{% endblock %}
{% block custom_css %}{% endblock %}
</head>
<body>
<div id="wrapper">
<!-- <div class="container" id="range">
<div class="row">
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-3" style="background-color:Yellow;">ExtraSmall</div>
<div class="hidden-xs col-sm-6 col-md-4 col-lg-3" style="background-color:green;">Small</div>
<div class="hidden-xs hidden-sm col-md-4 col-lg-3" style="background-color:blue;">Midium</div>
<div class="hidden-xs hidden-sm hidden-md col-lg-3" style="background-color:Red;">Large</div>
</div>
</div> -->
<!-- Header -->
<header id="header" class="header clearfix fixed transparent-header" >
<div class="container-fluid" id="header-inner">
<div class="row">
<!-- Global Navigation -->
<div id="gnav" class="" data-spy="affix" data-offset-top="94">
<nav class="navbar navbar-inverse" id="gnav_nav">
<ul class="nav navbar-nav" id="gnav_ul">
<li class="dropdown">
<a class="" data-toggle="dropdown" href="index.html">商品紹介</a>
<!-- Dropdown -->
<ul class="dropdown-menu">
<li>
<a class="" href='#'>ジュース <i class=""></i></a>
<ul class="sub-dropdown">
<li>オレンジ</li>
<li>アップル</li>
<li>グレープ</li>
</ul>
</li>
<li>
<a class="" href='#'>寿司 <i class=""></i></a>
<ul class="sub-dropdown">
<li>マグロ</li>
<li>サーモン</li>
<li>エンガワ</li>
</ul>
</li>
</ul> <!-- dropdown-menu -->
</li> <!-- .dropdown -->
<li class="dropdown">
<a class="" data-toggle="dropdown" href="index.html">ご注文</a>
<ul class="dropdown-menu">
<li>
<a class="" href='#'>スマートフォン <i class=""></i></a>
<ul class="sub-dropdown">
<li>iPhone</li>
<li>Xperia</li>
<li>Galaxy</li>
</ul>
</li>
<li>
<a class="" href='#'>野菜 <i class=""></i></a>
<ul class="sub-dropdown">
<li>トマト</li>
<li>レタス</li>
<li>枝豆</li>
</ul>
</li>
</ul> <!-- dropdown-menu -->
</li> <!-- .dropdown -->
<li class="dropdown">
<a class="" data-toggle="dropdown" href="index.html">お問い合わせ</a>
<ul class="dropdown-menu">
<li><a class="" href='#'>自分用</a></li>
<li><a class="" href='#'>他人用</a></li>
</ul> <!-- dropdown-menu -->
</li> <!-- .dropdown -->
<li class="dropdown">
<a class="" data-toggle="dropdown" href="index.html">会社案内</a>
<ul class="dropdown-menu">
<li><a class="" href='#'>フォーム</a></li>
<li><a class="" href='#'>電話</a></li>
</ul> <!-- dropdown-menu -->
</li> <!-- dropdown -->
</ul> <!-- .nav .navbar-nav -->
</nav> <!-- .navbar .navbar-default -->
</div> <!-- #gnav .col-md-9 -->
<!-- Logo -->
<div id="logo" class="">
<a href="#">
<img src="http://vignette2.wikia.nocookie.net/logopedia/images/e/ee/Burger_King_Logo.svg.png/revision/20120422044236" id="logo-img" class="img-responsive logo-img" height="50" width="50">
</a>
</div> <!-- #logo .col-sm-3 -->
</div> <!-- .row -->
</div> <!-- .container -->
</header> <!-- #header .clearfix -->
<section id="intro">
<article id="apple">
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
<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>
<li data-target="#carousel-example-generic" data-slide-to="2"></li>
</ol>
<div class="carousel-inner" role="listbox">
<div class="item active">
<img class="melon img-responsive" src="http://htmlcoder.me/preview/the_project/v.1.3/template/images/slider-fullscreen-slide-1.jpg" alt="First slide">
</div>
<div class="item">
<img class="melon img-responsive" src="http://htmlcoder.me/preview/the_project/v.1.3/template/images/slider-fullscreen-slide-2.jpg" alt="Second slide">
</div>
<div class="item" id="bg-image3">
<div class="bg-image" id="bg-image3">
<h2 class="" id="">This is the headline</h2>
<p class="" id="">This is a pen. This is an apple. U~n, apple pen.</p>
</div>
</div>
</div>
<a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
<span class="icon-prev" 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="icon-next" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
<div>
<span>Bootstrap carousel</span>
</div>
</article>
</section>
<h1><span>I LOVE TOMATO!!!!</span></h1><br>
<h1><span>I LOVE TOMATO!!!!</span></h1><br>
<h1><span>I LOVE TOMATO!!!!</span></h1><br>
<h1><span>I LOVE TOMATO!!!!</span></h1><br>
<h1><span>I LOVE TOMATO!!!!</span></h1><br>
<h1><span>I LOVE TOMATO!!!!</span></h1><br>
<h1><span>I LOVE TOMATO!!!!</span></h1><br>
<h1><span>I LOVE TOMATO!!!!</span></h1><br>
<h1><span>I LOVE TOMATO!!!!</span></h1><br>
<h1><span>I LOVE TOMATO!!!!</span></h1><br>
<h1><span>I LOVE TOMATO!!!!</span></h1><br>
<h1><span>I LOVE TOMATO!!!!</span></h1><br>
<h1><span>I LOVE TOMATO!!!!</span></h1><br>
</div> <!-- #wrapper -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script type="text/javascript" src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
</body>
</html>
Bootstrap: 3.3.4, HTML5, jQuery: 2.1.3
Set your image as background-image for that element with background-size: cover;
Set that element to height: 100vh;
Quick example: https://jsbin.com/dajepaw/1/
*{box-sizing:border-box;margin:0;}
html, body{height:100%;font:14px/1.4 sans-serif;}
header {
position: fixed;
z-index: 1;
width: 100%;
top: 0;
height: 72px;
background: #fff;
}
article {
background: #fff;
height: 50vh;
} article:nth-child(odd) {
background: #f7f7f7;
}
footer {
background: #444;
height: 72px;
}
/* SPECIAL CLASSES */
.fullWithBackground {
height: 100vh;
background: url(https://i.stack.imgur.com/LCupt.png) 50% fixed;
background-size: cover;
color: #fff;
}
.centerInner{
display: flex;
align-items: center;
justify-content: center;
}
<header>Header</header>
<div class="fullWithBackground centerInner">
<div>GALLERY</div>
</div>
<main>
<article>Article 1</article>
<article>Article 2</article>
</main>
<footer>Footer</footer>

Resources