Snipt.net is closing on December 31st, 2016

For more information, please visit this blog post.

snipt

Ctrl+h for KB shortcuts

CSS

CSS: Resize image to container's width

1
2
3
4
5
img {
    max-width: 100%;
    height: auto;
    width: auto\9; /* ie8 */
}
https://snipt.net/embed/ce510da033dbaee8b4f6210af95ea8bf/
https://snipt.net/raw/ce510da033dbaee8b4f6210af95ea8bf/
ce510da033dbaee8b4f6210af95ea8bf
css
CSS
5
2016-12-08T10:26:55
True
False
False
/api/public/snipt/52989/
css-resize-image-to-containers-width
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="nt">img</span> <span class="p">{</span> </span><span id="L-2"><a name="L-2"></a> <span class="nb">max-width</span><span class="o">:</span> <span class="m">100%</span><span class="p">;</span> </span><span id="L-3"><a name="L-3"></a> <span class="nb">height</span><span class="o">:</span> <span class="nb">auto</span><span class="p">;</span> </span><span id="L-4"><a name="L-4"></a> <span class="nb">width</span><span class="o">:</span> <span class="nb">auto</span><span class="err">\</span><span class="m">9</span><span class="p">;</span> <span class="c">/* ie8 */</span> </span><span id="L-5"><a name="L-5"></a><span class="p">}</span> </span></pre></div> </td></tr></table>
auto-resize, container, img, resize
Copyrighted, illegal, or inappropriate content? Email [email protected].