Image Stretching Issue for Mobile and Tablet
<p><strong>Problem:</strong> On the mobile version, the image is stretching on Portrait mode. As you can see below, it looks compressed.</p>

<p><a href="https://i.stack.imgur.com/TOIZO.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/TOIZO.jpg" alt="Portrait Mode"></a></p>

<p>On landscape mode, the image does not look stretched and looks exactly as the desktop version of the site. </p>

<p><a href="https://i.stack.imgur.com/pw0Ky.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/pw0Ky.jpg" alt="Landscape Mode"></a></p>

<p>I am using bootstrap and the images have class <em>img-responsive</em> and it does not work.</p>

<p>Below is the css that I wrote. I have tried setting <em>background-size:contain</em>, and some other approaches but did not render desired results. This project uses Coldfusion and Mura (CMS).</p>

<p><strong>UPDATE</strong></p>

<p>The following css is being used in an attempt to make it responsive:</p>

<pre><code>@media (min-width: 1024px) #homepage .carousel .item img {
  width:100%;
  height:auto;
}
media (min-width:769px) and (max-width:980px) {
  #homepage .carousel .item img {
    max-width: 100%;
    min-height: 100%;
    height: auto;
    margin-top: 154px !important;
  }
}
@media (max-width: 751px) and (orientation: landscape) {
  .override-hidden-xs1 {
    display: block;
  }
  .carousel-inner {
    width: 100% !important;
  }
  .fixNext {
    margin-right: 0px;
  }
  .carouselCaption {
    margin-top: 120px !important;
  }
  .h4Font {
    font-size: 16px !important;
  }
  .upcoming-events-image {
    max-width: 180px;
    max-height: 180px;
    width: 22% !important;
    margin-left: 340px !important;
  }
  .image-margin-top {
    margin-top: 170px !important;
    display: inline-block;
  }
}
@media (max-width: 767px) {
  #homepage .carousel .item {
    height: 200px;
    margin-top: 241px;
  }
  #homepage .carousel .item img {
    max-width: 100%;
    height: auto;
    display: block;
  }
}
@media (max-width: 767px) and (orientation: landscape) {
  #homepage .carousel .item {
    height: 200px;
    margin-top: 311px;
  }
}
@media (min-width: 768px) and (max-width: 980px) {
  .company-logo {
    width: 400px;
  }
  #homepage .carousel .item img {
    /*max-width: 1200px;*/
    max-width: 100%;
    min-height: 100%;
    padding-top: 162px;
  }
  #homepage .carousel .carousel-caption {
    margin-left: 64px;
  }
  .image-margin-top {
    margin-top: 57px !important;
  }
  .changePosition {
    margin-top: -193px !important;
  }
}
@media (min-width: 920px) {
  .company-logo {
    width: 400px;
  }
  #homepage .carousel .item img {
    /*max-width: 1200px;*/
    max-width: 100%;
    min-height: 100%;
  }
}
</code></pre>

<p>Below is the coldfusion code where it calls the images form the CMS:</p>

<pre><code>&lt;div class="row carousel-inner padding-topImage"&gt;
  &lt;cfset local.iterator.reset()&gt;
    &lt;cfset local.idx=0&gt;
      &lt;cfloop condition="local.iterator.hasNext()"&gt;
        &lt;cfset local.item=iterator.next()&gt;
          &lt;cfif ListFindNoCase( 'jpg,jpeg,gif,png', ListLast(local.item.getImageURL(), '.'))&gt;
            &lt;div class="row item img-responsive&lt;cfif local.idx eq 0&gt; active&lt;/cfif&gt;"&gt;
              &lt;img src="#local.item.getImageURL(argumentCollection=local.imageArgs)#" alt="#HTMLEditFormat(local.item.getTitle())#"&gt;
              &lt;cfif arguments.showCaption&gt;
                &lt;div class="container"&gt;
                  &lt;div class="carousel-caption carousel-caption1"&gt;
                    &lt;div&gt;
                      &lt;!--- &lt;h3&gt;&lt;a href="#local.item.getURL()#"&gt;#HTMLEditFormat(local.item.getTitle())#&lt;/a&gt;&lt;/h3&gt; ---&gt;
                      &lt;div class="visible-xs"&gt;
                        &lt;!---&lt;h2&gt;#HTMLEditFormat(local.item.getTitle())#&lt;/h2&gt;---&gt;
                      &lt;/div&gt;
                      &lt;div class="hidden-xs"&gt;#local.item.getSummary()#
                        &lt;!--- #local.item.getBody()# ---&gt;
                        &lt;!---&lt;p&gt;&lt;a class="btn btn-larg btn-primary" href="#local.item.getURL()#"&gt;Read More&lt;/a&gt;&lt;/p&gt;---&gt;
                      &lt;/div&gt;
                      &lt;!---&lt;div class="override-hidden-xs1 carouselCaption" style="color:##000"&gt;&lt;span class="h4Font"&gt;#HTMLEditFormat(local.item.getTitle())#&lt;/span&gt;
                                                &lt;/div&gt;---&gt;

                    &lt;/div&gt;
                  &lt;/div&gt;
                &lt;/div&gt;
              &lt;/cfif&gt;
            &lt;/div&gt;
            &lt;cfset local.idx++&gt;
          &lt;/cfif&gt;
      &lt;/cfloop&gt;
&lt;/div&gt;
</code></pre>

<p><strong>UPDATE</strong></p>

<p>Here is the issue I am having but I am not able to get around it.</p>

<p>The height is fixed and so I tried to height: auto but the images in the carousel disappears.</p>

<p>How would I modify the css so that the background height is dependent on the image being resize based on the screen size.</p>

<p>Here is the modified css:</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-css lang-css prettyprint-override"><code>@media (max-width: 747px){
 #homepage .carousel .item img{
  margin-top: 71px !important;
  max-width:0px;
  min-height:0%;
 }/*
 #homepage .carousel .item {
  height:180px !important;
 }*/
 .carousel-inner {
  height:auto;
 }
}
@media (min-width: 748px){
 #homepage .carousel .item img{
  max-width:0px;
  min-height:0%;
 }/*
 #homepage .carousel .item {
  height:180px !important;
 }*/
}

@media (max-width: 1024px) and (min-width: 768px){
 #homepage .carousel .item {
  width: 100% !important;
  /*margin-top: 20px !important;*/
  height:396px !important;
 }
}

/*@media (min-width:992px) and (max-width:1363px){
 #homepage .carousel .item img {
  /* width: 100% !important; 
  margin-top: 15px !important;
  max-height: auto;
  max-height: 100%;
  min-height: 80%;
 }
}

@media (min-width:1024px) and (max-width:1255px){

}*/

@media (min-width: 1024px){
 #homepage .carousel .item img {
  /* width: 100% !important; */
  margin-top: 15px !important;
  max-height: auto;
  max-height: 100%;
  min-height: 80%;
 }
}
@media (max-width:1263px) and (min-width:1024px){
 #homepage .carousel .item{ height:500px !important; }
  
 #homepage .carousel .carousel-caption { 
  left: 100px; 
  top: 80px;
  width: 500px;
 }
}

@media (min-width:1264px) and (max-width:1363px){
 #homepage .carousel .item{ height:502px !important; }
  #homepage .carousel .carousel-caption { 
  left: 99px;
  top: 100px;
 }
}

@media (min-width:1364px) and (max-width:1641px){
 #homepage .carousel .item{ height:540px !important; }
 
 #homepage .carousel .carousel-caption { 
  left: 170px; 
  top: 120px;
  width: 500px;
 }
  #homepage .carousel .carousel-caption { 
  left: 170px; 
  top: 80px;
  width: 500px;
 }
}

@media (min-width:1642px){
 #homepage .carousel .item{ height:650px !important; }
 
 #homepage .carousel .carousel-caption { 
  left: 170px; 
  top: 120px;
  width: 500px;
 }
}</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="row carousel-inner padding-topImage"&gt;
      
&lt;div class="row item myclass"&gt;

&lt;img src="/Regal-en-us/cache/file/90A5069B-155D-0201-11BF135B13F69E9A_W1280_H500.jpg" alt="Real People, Real Solutions See how we've helped make a difference in the lives of our members."&gt;
         
 &lt;div class="container"&gt;
  &lt;div class="carousel-caption carousel-caption1"&gt;
   &lt;div&gt;
   &lt;div class="visible-xs"&gt;&lt;/div&gt;
    &lt;div class="hidden-xs"&gt;&lt;h1 class="titleSlide"&gt;&lt;br&gt;
 Real People,&lt;br&gt;
 Real Solutions&lt;/h1&gt;

&lt;p class="content1"&gt;See how we’ve helped make a difference in the lives of our members.&lt;/p&gt;

&lt;p style="font-size: 12px; color: #ffffff;"&gt;&amp;nbsp;&lt;/p&gt;

&lt;p&gt;&lt;a class="btn btn-info1 styleText btn-primary" href="/index.cfm/doctor-finder/" role="button"&gt;Read More&lt;/a&gt;&lt;/p&gt;
&lt;!---&lt;p style="font-size: 12px; color: #ffffff;"&gt;&amp;nbsp;&lt;/p&gt;

&lt;p&gt;&lt;a class="btn btn-info" href="/index.cfm/doctor-finder/" role="button"&gt;Read More&lt;/a&gt;&lt;/p&gt;---&gt;
             
             
 &lt;/div&gt;
                                                
                                                
 &lt;/div&gt;
  &lt;/div&gt;
 &lt;/div&gt;
         
 &lt;/div&gt;
        
&lt;div class="row item myclass"&gt;

 &lt;img src="/Regal-en-us/cache/file/9CFFC7AA-155D-0201-119470C3C01460AE_W1280_H500.jpg" alt="Need an Urgent Care Center? There is one right in your neighborhood – and we will help you find it."&gt;
         
&lt;div class="container"&gt;
 &lt;div class="carousel-caption carousel-caption1"&gt;
   &lt;div&gt;
  &lt;div class="visible-xs"&gt;&lt;/div&gt;
    &lt;div class="hidden-xs"&gt;&lt;h1 class="titleSlide"&gt;&lt;br&gt;
 &lt;h1&gt;Need an Urgent Care Center?&lt;/h1&gt;

&lt;p class="content1"&gt;There is one right in your neighborhood –&lt;br&gt;
 and we will help you find it.&lt;/p&gt;

&lt;div class="embeddedContent oembed-provider-"&gt;&amp;nbsp;&lt;/div&gt;
&lt;!---&lt;p style="font-size: 12px; color: #ffffff;"&gt;&amp;nbsp;&lt;/p&gt;

&lt;p&gt;&lt;a class="btn btn-info1 styleText" href="http://oc2-web03/index.cfm/doctor-finder/" role="button"&gt;Find an Urgent Care&lt;/a&gt;&lt;/p&gt;---&gt;&lt;!---&lt;p style="font-size: 12px; color: #686868;"&gt;&amp;nbsp;&lt;/p&gt;---&gt;

&lt;p&gt;&lt;a class="btn btn-info1 slideText btn-primary urgentButton" href="/index.cfm/urgent-care-finder/" role="button"&gt;Find an Urgent Care&lt;/a&gt;&lt;/p&gt;
             
&lt;/div&gt;
&lt;/div&gt;
 &lt;/div&gt;
 &lt;/div&gt;
         
  &lt;/div&gt;
        
 &lt;div class="row item myclass active"&gt;

 &lt;img src="/Regal-en-us/cache/file/9CFD4EC1-155D-0201-11C0E45BAE92654E_W1280_H500.jpg" alt="Looking for a Doctor? We have just the right one for you."&gt;
         
 &lt;div class="container"&gt;
 &lt;div class="carousel-caption carousel-caption1"&gt;
 &lt;div&gt;
 &lt;div class="visible-xs"&gt;&lt;/div&gt;
  &lt;div class="hidden-xs"&gt;&lt;h1 class="titleSlide"&gt;&lt;br&gt;
 Looking for a doctor?&lt;/h1&gt;

&lt;p class="content1"&gt;We have just the right one for you.&lt;/p&gt;
&lt;!---&lt;p style="font-size: 12px; color: #ffffff;"&gt;&amp;nbsp;&lt;/p&gt;

&lt;p&gt;&lt;a class="btn btn-info1 styleText" href="/index.cfm/doctor-finder/" role="button"&gt;Read More\\\&lt;/a&gt;&lt;/p&gt;---&gt;

&lt;p style="font-size: 12px; color: #686868;"&gt;&amp;nbsp;&lt;/p&gt;

&lt;p&gt;&lt;a class="btn btn-info1 slideText btn-primary" href="/index.cfm/doctor-finder/" role="button"&gt;Find a Doctor Now&lt;/a&gt;&lt;/p&gt;
             
             
&lt;/div&gt;
                                                
                                                
&lt;/div&gt;
 &lt;/div&gt;
  &lt;/div&gt;
         
 &lt;/div&gt;
        
 &lt;div class="row item myclass"&gt;

 &lt;img src="/Regal-en-us/cache/file/22E66EFF-155D-0201-11F1D4090927E676_W1280_H500.jpg" alt="Snow Machines Run as Winter Winds Down"&gt;
         
          &lt;div class="container"&gt;
           &lt;div class="carousel-caption carousel-caption1"&gt;
               &lt;div&gt;
            
            &lt;div class="visible-xs"&gt;&lt;/div&gt;
             &lt;div class="hidden-xs"&gt;&lt;p&gt;Curabitur ut suscipit tellus. Maecenas rhoncus, ante vitae vehicula vestibulum, metus sapien dapibus tellus, et mattis dolor neque vitae nisl.&lt;/p&gt;
             
             
            &lt;/div&gt;
                                                
                                                
            &lt;/div&gt;
           &lt;/div&gt;
          &lt;/div&gt;
         
        &lt;/div&gt;
        
     &lt;/div&gt;</code></pre>
</div>
</div>
</p>

<p>Because of the fixed height, the following is occuring in the mobile and tablet version. I have tried to remove the item classs that is causing the issue but as mentioned, it is makes the carousel to disappear</p>

<p>Any help would be appreciated
<a href="https://i.stack.imgur.com/1FmrX.png" rel="noreferrer"><img src="https://i.stack.imgur.com/1FmrX.png" alt="enter image description here"></a></p>

<p><a href="https://i.stack.imgur.com/b65Yj.png" rel="noreferrer"><img src="https://i.stack.imgur.com/b65Yj.png" alt="enter image description here"></a></p>