McLaren
McLaren

Reputation: 776

make image fit full screen without scroll bars

I need to make a header image full screen. I tried this:

<div class="wrapper">
   <img src="images/image1.jpg" class="img-responsive" alt="Responsive image">
</div>

But here is the picture:

enter image description here

Somehow window still need to scroll down as you can see, how can i fix this, to fit in screen?

Upvotes: 5

Views: 18580

Answers (2)

Michael Benjamin
Michael Benjamin

Reputation: 371739

Try this:

.img-responsive { background-size: 100%; }

OR

.img-responsive { background-size: cover; }

OR (based on revised question)

Add this to body:

overflow: hidden;

Upvotes: 8

Praseetha KR
Praseetha KR

Reputation: 743

Instead of img tag, use background-image for fullscreen image.

<header>
  <div class="menu_area">...</div>
</header>


html, body, header {
    height: 100%;
}
header {
    background-image: url('images/image1.jpg');
    background-size: cover;
}

Upvotes: 2

Related Questions