code-8
code-8

Reputation: 58652

How to make an image to fit the whole container width?

I'm trying to make my image to fit the whole container width.

enter image description here

I've tried :

None of those work.

<div class="container" style="background-color:gray;">
    <div width="100%">
        <img width="100%" src="http://s6.postimg.org/7ic0egypt/report_nav.png">
    </div>
</div

JSFiddle

Upvotes: 0

Views: 235

Answers (2)

bcr
bcr

Reputation: 3811

Set the container padding to 0. I rewrote your fiddle using CSS

Upvotes: 1

Adam Buchanan Smith
Adam Buchanan Smith

Reputation: 9439

Here add this to your css, by default the body has a margin of 8px.

body{margin: 0px;}

Upvotes: 1

Related Questions