Bootstrap - stretch hero images

nsitedesigns
nsitedesigns used Ask the Experts™
on
How do I stretch the hero image (big pic to right of nav) so it fits the largest desktop size?  We got the animation to work good but that is only be on the home page.  

I played around with this on the below page:

http://nsitedesigns.com/nsitedesigns/wiplastic_scott/about2.html
http://nsitedesigns.com/nsitedesigns/wiplastic_scott/wiplastic2.css
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Author

Commented:
does anyone have any ideas?
Neil_BradleyWeb UX/UI Developer

Commented:
You need to change your actual image width from 752px to 100% (height auto or 100%) then it will stretch to fit its container.. By giving it an actual px size it will never respond to its containing environment.
You may need to play around with the css for the hero as the image height will then be greater that your left hand menu and look a bit odd.

Cheers,
N

Author

Commented:
Would I change BOTH width and height to 100%?
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Neil_BradleyWeb UX/UI Developer

Commented:
You could although height auto will work as long as the width is set to 100%.
N

Author

Commented:
The nav works good for the slider animation.  If I change the css for the nav, then that won't look right.  It's like a catch-22.  fix one thing and the other goes bad.
Scott FellDeveloper & EE Moderator
Fellow 2018
Most Valuable Expert 2013

Commented:
I could have sworn I had this all working already...  
The side nav is not really normal set up.  To do what you want, we need to hide one version of the hero for larger screens and then switch out.  http://jsbin.com/koniximi/1/

Now it is a matter of getting the white background back when xs.

   <div id="xanimation_container" class="hidden-xs col-xs-12 col-sm-9 ihero">
        <img src="http://nsitedesigns.com/nsitedesigns/wiplastic_scott/img/pl4_2.jpg" class="img-responsive" /> 
      </div>
        <div class="visible-xs ihero">
        <img src="http://nsitedesigns.com/nsitedesigns/wiplastic_scott/img/pl4_2.jpg" class="img-responsive" /> 
      </div>
      
      <!-- end hero -->

Open in new window

Author

Commented:
Hi Scott,

I was working on getting the slider to work and that messed up the other code you provided.
Developer & EE Moderator
Fellow 2018
Most Valuable Expert 2013
Commented:
What is happening is the .col- is adding left and right padding.  The solution I provided is an easy work around.  You could also use a media query and set the class ihero to padding:0px!important when below the xs threshold.  The way I have provide work within bootstrap.  Either way is good.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial