Carousel Images Height Shrinking - image

I've got a carousel on my index page, but I've noticed that if I shrink my browser, the image doesn't stay within the whole carousel.
If you don't understand what I mean, here's an image of the carousel after shrinking the browser:
As you can see, the width of the image responds to the browser window size, but the height doesn't, leaving that big white space below the image.
Here is my current code:
<div class='carousel slide' id='hero' style='position: absolute;'>
<div class='carousel-inner' style='z-index: -1'>
<div class='active item'>
<img src='images/index/img1.jpg'>
</div>
<div class='item'>
<img src='images/index/img2.jpg'>
</div>
<div class='item'>
<img src='images/index/img3.jpg'>
</div>
<div class='item'>
<img src='images/index/img4.jpg'>
</div>
<div class='item'>
<img src='images/index/img5.jpg'>
</div>
<div class='item'>
<img src='images/index/img6.jpg'>
</div>
</div>
</div>
How do I make the images within the carousel respond to smaller browser windows?

So I've fixed it myself after some more research.
In the CSS, I had this:
.carousel-inner {
overflow:hidden;
width:100%;
position:relative;
}
I fixed it by putting the dimensions of the images instead of the 100% width, so:
.carousel-inner {
overflow:hidden;
width:1920px;
height:1200px;
position:relative;
}

Related

Image not position not correct?

In this code i am preparing a portfolio, now when i am placing an
image in my portfolio the image is not filling the border div and
going a side as you can see in the picture <IMAGE-first half> , <IMAGE-second half>. Can someone help me to keep four images that has borders only to the image and I need all four images placed like four boxes?
<section class="latestwork" id="work">
<div class="container">
<div class="row">
<div class="heading">
<h2 class="boxx">My Latest Work</h2>
<h6>These are my latest mobile photography captures</h6>
</div>
</div>
<div class="row">
<div class="myworkbuttons">
<button type="button" class="myworklink" data-filter="all">All</button>
<button type="button" class="myworklink" data-filter="creative">Creative</button>
<button type="button" class="myworklink" data-filter="black&white">Black/white</button>
<button type="button" class="myworklink" data-filter="portrait">Portraits</button>
</div>
</div>
<div class="row">
<div class="portfolio-items" data-category="urban-floods">
<div class="portfolio-inner-item" style="">
<div class="portfolio-img">
<img src="C:\portfolio's\drive-download-20210208T164603Z-001\The Disaster of 2020.jpg" alt="Image not loading">
</div>
</div>
<div class="portfolio-info">
<h4>Iso: </h4>
</div>
</div>
<div class="portfolio-items" data-category="buffalo">
<div class="portfolio-inner-item">
<div class="portfolio-img">
<img src="C:\portfolio's\drive-download-20210208T164603Z-001\buffalos path.jpg" style="float: left;" alt="Image not loading">
</div>
</div>
</div>
</div>
This is happening because the size of the image is not big enough.
Try adding width: 100% of the image component.
you can use grid and and use css importing file and try this code: .div{background-image: url("/assets/pics/picture.jpg"); background-position: center; background-repeat: no-repeat; background-size: cover; min-height:50vh; min-width:50vw }//(or what size do you need.);

Issue In Aligning Images With Bootstrap4

I am trying to align images with Bootstrap 4. I've used .row within a .container. I now have whitespace between images and I don't want it to be that way. I want the images aligned immediately next to each other without any spaces. Any suggestions would be appreciated.
<div class="container mycontainer">
<div class="row">
<div class="col-sm-12 col-md-6 col-lg-6" id="one"> <!-- FIRST ROW LEFT SIDE-->
<img src="./images-for-sample/images-for-sample/investors-img-1.jpg" alt="" class="img-responsive" id="photo-1">
</div>
<div class="col-sm-12 col-md-6 col-lg-6" id="two"> <!-- FIRST ROW RIGHT SIDE-->
<img src="./images-for-sample/images-for-sample/investors-img-4.jpg" alt="" class="img-responsive" id="photo-4">
</div>
</div>
<div class="row">
<div class="col-sm-12 col-md-6 col-lg-6" id="three"> <!-- SECOND ROW LEFT SIDE-->
<img src="./images-for-sample/images-for-sample/investors-img-2.jpg" alt="" class="img-responsive" id="photo-2">
</div>
<div class="col-sm-12 col-md-6 col-lg-6" id="four"> <!-- SECOND ROW RIGHT SIDE-->
<img src="./images-for-sample/images-for-sample/investors-img-5.jpg" alt="" class="img-responsive" id="photo-5">
</div>
</div>
<div class="row">
<div class="col-sm-12 col-md-6 col-lg-6" id="five"> <!-- THIRD ROW LEFT SIDE-->
<img src="./images-for-sample/images-for-sample/investors-img-3.jpg" alt="" class="img-responsive" id="photo-3">
</div>
<div class="col-sm-12 col-md-6 col-lg-6" id="six"> <!-- THIRD ROW RIGHT SIDE-->
<img src="./images-for-sample/images-for-sample/investors-img-6.jpg" alt="" class="img-responsive" id="photo-6">
</div>
</div>
</div>
The output I get currently is:
In order to achieve your targeted goal you have to remove Bootstrap's paddings for each div and set the images width to 100% of those:
// you could also use img as a selector
.img-responsive {
width: 100%;
}
// this is the selector of your div's
.col-sm-12 {
padding: 0;
}
However, due to your current implementation this would result in the following (for a running fiddle click here):
If you additionally want to remove the whitespaces shown in the image, you could use Bootstrap's card columns like this:
<div class="card-columns">
<div class="card" id="one"> <!-- FIRST ROW LEFT SIDE-->
<img src="https://via.placeholder.com/350x200" alt="" class="img-responsive" id="photo-1">
</div>
<div class="card" id="two"> <!-- FIRST ROW RIGHT SIDE-->
<img src="https://via.placeholder.com/350x150" alt="" class="img-responsive" id="photo-4">
</div>
<div class="card" id="three"> <!-- SECOND ROW LEFT SIDE-->
<img src="https://via.placeholder.com/350" alt="" class="img-responsive" id="photo-2">
</div>
<div class="card" id="four"> <!-- SECOND ROW RIGHT SIDE-->
<img src="https://via.placeholder.com/350x450" alt="" class="img-responsive" id="photo-5">
</div>
<div class="card" id="five"> <!-- THIRD ROW LEFT SIDE-->
<img src="https://via.placeholder.com/350" alt="" class="img-responsive" id="photo-3">
</div>
<div class="card" id="six"> <!-- THIRD ROW RIGHT SIDE-->
<img src="https://via.placeholder.com/350" alt="" class="img-responsive" id="photo-6">
</div>
</div>
and adjust it with some css to your need:
// the default column count is 1 and there should not be a space between the columns
.card-columns {
column-count: 1;
column-gap: 0;
}
// for medium devices and larger set the count to two
#media (min-width: 768px) {
.card-columns {
column-count: 2;
}
}
// reset card's margin bottom
.card {
margin: 0 !important;
}
// scale images properly to fit the divs
img {
width: 100%;
max-width: 100%;
}
The result looks like this:
You can find the running fiddle here.
If you are using Bootstrap 3, have a look at this Medium article.
Good luck!

Full sizing an image which is into an inline block element

This is my code structure...
<div class="container">
<div class="img-container" style="display:inline-block;">
<img src="image/exaple.png" style="width:100%" />
</div>
</div>
I need to increase the width of the image to 100%. but the img-container div not expanding to 100%. how can i resolve this?

PNG only scales from large to normal size instead of normal to small with IMG-Responsive

I'm having a problem scaling a png image with a transparent background with a width of 279 pixels and height of 432 pixels with class img-responsive on bootstrap3.
The Problem:
Whenever, I upload the png image inside the img tag with the class=
"img-fluid" it remains the same size as I scale. Other images seems to
work fine, but if I try to upload a bigger image it will become
responsive but only scale from very large to normal size, not from
normal to small.
My question is
What is the best way to optimize a PNG image for Bootstrap-3 with the class img-responsive?
HTML:
<div class="poster">
<div class="container">
<div class="intro-text">
<div class="intro-heading">Welcome <img href="../html/indexfinal.html" class="bigv" src="../images/logos/bigvlogo.png" alt=""/> <img href="../html/indexfinal.html" class="midv" src="../images/logos/midvlogo.png" alt=""/> </div>
<div class="intro-lead-in">Hi yall'</div>
<div class="container-fluid">
<img class="mascot" src="../images/mascot/wave.png">
</div>
<a style="float:left" id="guestsignup"></a>
</div>
</div>
</div>
It will work.
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
<div class="row">
<div class="col-md-6">
<img src="http://farm5.static.flickr.com/4017/4717107886_dcc1270a65_b.jpg" class="img-responsive" alt="Cinque Terre">
</div>
</div>
</div>
Resize the screen to see the difference.
You can add img-responsive class to existing code:
<img class="mascot img-responsive" src="http://farm5.static.flickr.com/4017/4717107886_dcc1270a65_b.jpg">
Hope that is what you are looking for.

Whitespace is clickable with href image's

I am using bootstrap framework.
<div class="container">
<h1>Menu</h1>
<div class="row">
<div class="col-md-4">
<img src="images/placeholder-200x200.jpg" alt="Image" class="img-rounded center-block">
Step 1: Credit & Money
</div>
<div class="col-md-4">
<img src="images/placeholder-200x200.jpg" alt="Image" class="img-rounded center-block">
Step 1: Credit & Money
</div>
<div class="col-md-4">
<img src="images/placeholder-200x200.jpg" alt="Image" class="img-rounded center-block">
Step 1: Credit & Money
</div>
</div>
</div> <!-- /container -->
Whitespace on the left and right sides of the images are also clickable - looks like .center-block is the culprit. How to solve?
A block spans the entire div, and centers by using margin. As a link, I would suggest instead removing the center-block from the images themselves, creating a class:
.center {
text-align: center;
}
and setting that class on the containing div, in your case:
<div class="col-md-4 center">
Or something similiar.
Also I would suggest placing your text description for each image into a div, since without the image being a block, the text would flow next to it. Simply placing the text in a paragraph tag would suffice.
Here is a jsbin to demonstrate:
http://jsbin.com/zamavoha/1/edit

Resources