简体   繁体   中英

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

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

在此处输入图片说明

I've tried :

  • give my image of width="100%"
  • place my image within a div that have width of 100%

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

此处将其添加到您的CSS中,默认情况下,正文的边距为8px。

body{margin: 0px;}

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM