How to make two columns the same height and responsive - html

I am trying to make two bootstrap columns the same height and responsive.
So far I have the two columns the same height but as the screen size gets smaller one columns becomes shorter than the other. Like this:
To make the two columns I used Bootstrap 3.
My HTML:
<div class="col-md-6">
<div class="col-md-12 pb-20">
<div class="btn-container">
<img src="http://via.placeholder.com/1200x500" alt="Snow" style="max-height: 500px;">
<button class="btn">BREAKFAST MENU</button>
</div>
</div>
<!--
-->
<div class="col-md-12 pb-20">
<div class="btn-container">
<img src="http://via.placeholder.com/1200x500" alt="Snow" style="max-height: 500px;">
<button class="btn">DRINKS MENU</button>
</div>
</div>
</div>
<!--
-->
<div class="col-md-6 hard--right">
<div id="carousel-example" class="carousel slide" data-ride="carousel" style="width:100%;">
<ol class="carousel-indicators">
<li data-target="#carousel-example" data-slide-to="0" class="active"></li>
<li data-target="#carousel-example" data-slide-to="1"></li>
<li data-target="#carousel-example" data-slide-to="2"></li>
<li data-target="#carousel-example" data-slide-to="3"></li>
<li data-target="#carousel-example" data-slide-to="4"></li>
</ol>
<div class="carousel-inner">
<div class="item active">
<img src="http://via.placeholder.com/1200x1200" alt="" style="max-height: 1020px; width:100%">
</div>
<div class="item">
<img src="http://via.placeholder.com/1200x1200" style="max-height: 1020px; width:100%" style="width:100%" alt="Second slide" />
</div>
<div class="item">
<img src="http://via.placeholder.com/1200x1200" style="max-height: 1020px; width:100%" alt="Third slide" />
</div>
<div class="item">
<img src="http://via.placeholder.com/1200x1200" style="max-height: 1020px; width:100%" alt="Fourth slide" />
</div>
<div class="item">
<img src="http://via.placeholder.com/1200x1200" style="max-height: 1020px; width:100%" alt="Fifth slide" />
</div>
</div>
<div class="main-text hidden-xs">
<div class="text-center">
<button class="btn">MAIN MENU</button>
</div>
</div>
</div>
</div>
The Codepen to my problem is https://codepen.io/mrsalami/pen/dKpdXO

Images have width: 100%, so when screen resizes they reduce their width based on parent's width (50% of screen width size).
This caused the height of the images to resize too, based on their original aspect ratio.
So this will work if:
right image's height = ( left images height * 2 ) + space between.

Related

media queries in bootstrap carousel

I am trying to make simple carousel using bootstrap and im having a problem with image sizes, i want it to be full screen images. does that mean that i have to add media queries? if yes how can I do that?
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<div class="carousel-inner">
<div class="item active">
<img src="imagehere.png">
</div>
<div class="item">
<img src="imagehere.png">
</div>
<div class="item">
<img src="imagehere.png">
</div>
</div>
</div>
No,you don't have to add media queries. Set image width to 100%. Give each image a class of img-fluid and set your body margin to 0
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<!-- Wrapper for slides -->
<div class="carousel-inner">
<div class="item active">
<img class="img-fluid" src="https://images.unsplash.com/photo-1472722886393-f2f51e9deec8?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=750&q=80"
width="100%" height="100%">
</div>
<div class="item">
<img class="img-fluid" src="https://images.unsplash.com/photo-1531682607150-08b2476a545a?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=742&q=80"
width="100%" height="100%">
</div>
<div class="item">
<img class="img-fluid" src="https://images.unsplash.com/photo-1498595664159-2df8dee7e63c?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=750&q=80"
width="100%" height="100%">
</div>
</div>

Container row alignment issue

I'm currently working on my first ever website, this is using the twitter-bootstrap 4 framework. Everything was going swimmingly, until I have seemingly encountered the following issue.
I currently have this layout for my website:
Current Layout
When in fact I would like:
Desired Layout
I have attempted a plethora of solutions that I have found via browsing stack-overflow, such as nesting columns. None of it seems to work, I'm sure it is simply due to my inexperience, but I'm stumped as to how to get my desired appearance.
<div class="container-fluid bg-style-2">
<div class="row">
<div class="col-sm-9 par-style"><h2 class="par-heading">Welcome to my Website</h2>
</div>
<div class="col-sm-3">
<div id="myCarousel" class="carousel slide pull-right" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"><img src="img/Christina.JPG" alt="..."></li>
<li data-target="#myCarousel" data-slide-to="1"><img src="img/NickyAndChristina.JPG" alt="..."></li>
<li data-target="#myCarousel" data-slide-to="2"><img src="img/Nicky.JPG" alt="..."></li>
<li data-target="#myCarousel" data-slide-to="3"><img src="img/Meme.JPG" alt="..."></li>
</ol>
<div class="carousel-inner">
<div class="carousel-item active">
<img class="d-block w-100" src="img/Christina.JPG" alt="First slide">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="img/NickyAndChristina.JPG" alt="Second slide">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="img/Nicky.JPG" alt="Third slide">
</div>
<div class="carousel-item">
<img class="d-block w-100" src="img/Meme.JPG" alt="Fourth slide">
</div>
</div>
</div>
</div>
</div>
</div> <!-- End of Carousel -->
<div class="container-fluid bg-style-2">
<div class="row">
<div class="col-sm-9 par-style"><h2 class="par-heading">Test Header</h2>
</div>
</div>
</div>
As seen above, I am trying to have a photo gallery slider to the right of my website and the formatting I have attached above, it simply will not work. Can someone please give me some guidance? I have been thoroughly enjoying working on this website, but I cannot progress until I have resolved this as it will plague my mind.
#nedge
https://jsfiddle.net/saurabhanand/4f0pztcu/2/
<div class="container">
<div class="row container-0">
<div class="col-sm-6">
<div class="row container-1">
<div class="col-sm-12">
<img class="rgt-side-img" src="https://via.placeholder.com/500x250">
</div>
</div>
<div class="row container-2">
<div class="col-sm-6">
<img class="rgt-side-img" src="https://via.placeholder.com/500">
</div>
<div class="col-sm-6">
<img class="rgt-side-img" src="https://via.placeholder.com/500">
</div>
</div>
</div>
<div class="col-sm-6">
<img class="rgt-side-img" src="https://via.placeholder.com/500">
</div>
</div>
</div>
I hope this one helps. You can replace img tag with your own contents.

Background image of the section to Specific Height

What I really want to achieve is that to put the background image to a specific height like I have one section which contains two divs I gave the section a background image
which is
background-image: linear-gradient(-207deg, #0EC573, #0093FF);
Now I want to achieve is the background image covers the whole of the Second div and some part of the first div
FULL CODE
<section class="company py-4" >
<div class="container">
<div class="row">
<div class="col-12">
<div class="mt-5 px-3">
<div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel" data-interval="4000">
<ol class="carousel-indicators">
<li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li>
<li data-target="#carouselExampleIndicators" data-slide-to="1"></li>
<li data-target="#carouselExampleIndicators" data-slide-to="2"></li>
<li data-target="#carouselExampleIndicators" data-slide-to="3"></li>
</ol>
<div class="carousel-inner">
<div class="carousel-item active">
<img class="img-fluid" src="{!! asset('images/Company/02.jpg') !!}">
<div class="mt-5 ">
</div>
</div>
<div class="carousel-item ">
<div class="justify-content-center align-items-center">
<img class="img-fluid" src="{!! asset('images/Company/01.jpg') !!}">
</div>
<div class="mt-5 ">
</div>
</div>
<div class="carousel-item">
<img class="img-fluid" src="{!! asset('images/Company/03.jpg') !!}">
<div class="mt-5 ">
</div>
</div>
<div class="carousel-item">
<img class="img-fluid" src="{!! asset('images/Company/04.jpg') !!}">
<div class="mt-5 ">
</div>
</div>
</div>
<!-- <a class="carousel-control-prev" href="#carouselExampleIndicators" 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="#carouselExampleIndicators" 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>
</div>
<div class="container">
<div class="row justify-content-center align-items-center">
<div class="col-12 ">
<h1 class="text-left heading">Company</h1>
<p class="text-left description"> ALL THE DESCRIPTION</p>
</div>
</div>
</div>
</section>
Use it (See JSFiddle:https://jsfiddle.net/Lfxja1e5/7/) :
background-size: 100% 70%;
background-repeat: no-repeat;
**If you want it in bottom use:
background-position: bottom;
.company{
background-image:linear-gradient(-207deg,#0EC573, #0093FF);
background-size: 100% 70%;
background-repeat: no-repeat;
background-position: bottom;
}
<section class="company py-4" >
<div class="container d1">
<div class="row">
<div class="col-12">
<div class="mt-5 px-3">
<div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel" data-interval="4000">
<ol class="carousel-indicators">
<li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li>
<li data-target="#carouselExampleIndicators" data-slide-to="1"></li>
<li data-target="#carouselExampleIndicators" data-slide-to="2"></li>
<li data-target="#carouselExampleIndicators" data-slide-to="3"></li>
</ol>
<div class="carousel-inner">
<div class="carousel-item active">
<img class="img-fluid" src="{!! asset('images/Company/02.jpg') !!}">
<div class="mt-5 ">
</div>
</div>
<div class="carousel-item ">
<div class="justify-content-center align-items-center">
<img class="img-fluid" src="{!! asset('images/Company/01.jpg') !!}">
</div>
<div class="mt-5 ">
</div>
</div>
<div class="carousel-item">
<img class="img-fluid" src="{!! asset('images/Company/03.jpg') !!}">
<div class="mt-5 ">
</div>
</div>
<div class="carousel-item">
<img class="img-fluid" src="{!! asset('images/Company/04.jpg') !!}">
<div class="mt-5 ">
</div>
</div>
</div>
<!-- <a class="carousel-control-prev" href="#carouselExampleIndicators" 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="#carouselExampleIndicators" 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>
</div>
<div class="container d2">
<div class="row justify-content-center align-items-center">
<div class="col-12 ">
<h1 class="text-left heading">Company</h1>
<p class="text-left description"> ALL THE DESCRIPTION</p>
</div>
</div>
</div>
</section>

Image is not responsive inside carousel using ng2-bootstrap

Anybody know why is the image inside first carousel not responsive?
And how to make it responsive like the second one (Normal Bootstrap version) below. First one was created using ng2-bootstrap
Here is the html I have:
<h1>ng2-bootstrap carousel</h1>
<carousel>
<slide>
<img class="first-slide" src="http://placehold.it/800x400" alt="First slide" class="center-block">
<div class="container">
<div class="carousel-caption">
<h1>Example headline.</h1>
<p>Descr1</p>
<p><a class="btn btn-lg btn-primary" href="#" role="button">Sign up today</a></p>
</div>
</div>
</slide>
<slide>
<img class="second-slide" src="http://placehold.it/800x400" alt="Second slide" class="center-block">
<div class="container">
<div class="carousel-caption">
<h1>Another example headline.</h1>
<p>Descr2.</p>
<p><a class="btn btn-lg btn-primary" href="#" role="button">Learn more</a></p>
</div>
</div>
</slide>
</carousel>
<h1>Normal Bootstrap carousel</h1>
<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">
<div class="item active">
<img src="http://placehold.it/800x400" alt="...">
<div class="carousel-caption">
<h2>Heading</h2>
</div>
</div>
<div class="item">
<img src="http://placehold.it/800x400" alt="...">
<div class="carousel-caption">
<h2>Heading</h2>
</div>
</div>
<div class="item">
<img src="http://placehold.it/800x400" alt="...">
<div class="carousel-caption">
<h2>Heading</h2>
</div>
</div>
</div>
<!-- Controls -->
<a class="left carousel-control" href="#carousel-example-generic" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
</a>
<a class="right carousel-control" href="#carousel-example-generic" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
</a>
</div>
For image response, Please add class img-responsive or add below code
display: block;
max-width: 100%;
height: auto;
Image treatment for responsive design:
Image scale down-up
img {
width: 100%;
height: auto;
}
Image scale down but no up
img {
max-width: 100%;
height: auto;
}
Background mantain proportion and scale by one axis
width: 100%;
height: 400px;
background-repeat: no-repeat;
background-size: contain;
background-image: url('img.jpg');
Background deforms but adapt to container
width: 100%;
height: 400px;
background-image: url('img.jpg');
background-size: cover;
Turns out, bootstrap hierarchy gets broken with ng2's tags in-between. adding img-responsive class to the <img ..> resolved the issue.
Only For the sake of completeness:
<h1>ng2-bootstrap carousel</h1>
<carousel>
<slide>
<img class="first-slide" src="http://placehold.it/800x400" alt="First slide" class="center-block img-responsive">
<div class="container">
<div class="carousel-caption">
<h1>Example headline.</h1>
<p>Descr1</p>
<p><a class="btn btn-lg btn-primary" href="#" role="button">Sign up today</a></p>
</div>
</div>
</slide>
<slide>
<img class="second-slide" src="http://placehold.it/800x400" alt="Second slide" class="center-block img-responsive">
<div class="container">
<div class="carousel-caption">
<h1>Another example headline.</h1>
<p>Descr2.</p>
<p><a class="btn btn-lg btn-primary" href="#" role="button">Learn more</a></p>
</div>
</div>
</slide>
</carousel>

Bootstrap Carousel Indicators Not Changing from Transparent to Solid

The carousel indicators on this Bootstrap photo carousel work in that they change the photo appropriately when clicked on; however, they don't work in that if I have clicked on the third carousel indicator, the first carousel indicator remains solid while the third remains transparent. Any ideas on why this might be happening?
<div id="photos_overlay">
<div class="container-fluid">
<div class="row">
<div class="cta-overlay col-lg-4 col-md-5 col-sm-6">
<h1>Freshwater Ranch</h1>
<h4>Freshwater Ranch is located deep within the heart of the Rocky Mountains. The luxury accommodations and equine facilities on this 450-acre ranch were designed to support personal and professional getaways alike, and the awe-inspiring views of the Sawatch and Sangre de Cristo mountain ranges allow for a unique mountain experience. Join us and prepare to be inspired!</h4>
</div>
<ol class="carousel-indicators">
<li data-target="#rotating_photos" data-slide-to="0" class="active"></li>
<li data-target="#rotating_photos" data-slide-to="1"></li>
<li data-target="#rotating_photos" data-slide-to="2"></li>
<li data-target="#rotating_photos" data-slide-to="3"></li>
</ol>
</div>
</div>
<div class="photo_body carousel slide" data-ride="carousel" id="rotating_photos">
<div class="carousel-inner">
<div class="item active">
<img src="images/ranchhouseview1.jpg" alt="Indoor Arena Photo">
</div>
<div class="item">
<img src="images/view4.jpg" alt="Indoor Arena Photo">
</div>
<div class="item">
<img src="images/horse.jpg" alt="Horse Photo">
</div>
<div class="item">
<img src="images/view5.jpg" alt="Mountain Photo">
</div>
</div><!--carousel inner-->
</div><!--carousel outer-->
</div>
Your carousel-indicators have to be inside carousel div like this:
<div class="photo_body carousel slide" data-ride="carousel" id="rotating_photos">
<ol class="carousel-indicators">
<li data-target="#rotating_photos" data-slide-to="0" class="active"></li>
<li data-target="#rotating_photos" data-slide-to="1"></li>
<li data-target="#rotating_photos" data-slide-to="2"></li>
<li data-target="#rotating_photos" data-slide-to="3"></li>
</ol>
<div class="carousel-inner">
<div class="item active">
<img src="images/ranchhouseview1.jpg" alt="Indoor Arena Photo">
</div>
<div class="item">
<img src="images/view4.jpg" alt="Indoor Arena Photo">
</div>
<div class="item">
<img src="images/horse.jpg" alt="Horse Photo">
</div>
<div class="item">
<img src="images/view5.jpg" alt="Mountain Photo">
</div>
</div>
<!--carousel inner-->
</div>
<!--carousel outer-->
</div>