luckycharm-boy luckycharm-boy - 6 months ago 11
HTML Question

How to make an image screen-wide with Bootstrap?

I have tried to nest the image in a

jumbotron
and a
container
but to no avail. Here's my latest effort that didn't quite work out:

<div class="row">
<div class="full-width-div">
<div class="col-md-12">
<img src="http://i665.photobucket.com/albums/vv18/luckycharm_boy/Miami-Skyline-HD-Wallpapers1.jpeg_zps18p2ssu0.gif" alt=“90s Video Game Aesthetic Miami Skyline Photo”/>
</div>
</div>
</div>

Answer

you are missing class container to wrap it, and add img-responsive to img

<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-xs-12 col-md-12">
      <img class="img-responsive" src="http://i665.photobucket.com/albums/vv18/luckycharm_boy/Miami-Skyline-HD-Wallpapers1.jpeg_zps18p2ssu0.gif" alt=“90s Video Game Aesthetic Miami Skyline Photo”/>
    </div>
  </div>
</div>

UPDATE (taken from comments)

that's because your image is smaller than the container 1024px(img) VS 1170px(in md view) so either

  • use a larger image like here

    or

  • set width:100% to img and also remove class img-responsive for larger screens (media queries)

Comments