snipt

Ctrl+h for KB shortcuts

CSS

CSS box model fix

1
2
3
4
5
6
7
Fix for the crazy CSS 2 box model

-webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */
-moz-box-sizing: border-box;    /* Firefox, other Gecko */
box-sizing: border-box;         /* Opera/IE 8+ */

Not supported in IE6 and IE7
https://snipt.net/embed/17b46dff5a4db622c1205e97bb0d3869/
/raw/17b46dff5a4db622c1205e97bb0d3869/
17b46dff5a4db622c1205e97bb0d3869
css
CSS
7
2019-07-15T23:02:50
True
False
False
/api/public/snipt/27319/
css-box-model-fix
<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> <a href="#L-6">6</a> <a href="#L-7">7</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">Fix</span> <span class="nt">for</span> <span class="nt">the</span> <span class="nt">crazy</span> <span class="nt">CSS</span> <span class="nt">2</span> <span class="nt">box</span> <span class="nt">model</span> </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a><span class="nt">-webkit-box-sizing</span><span class="o">:</span> <span class="nt">border-box</span><span class="o">;</span> <span class="c">/* Safari/Chrome, other WebKit */</span> </span><span id="L-4"><a name="L-4"></a><span class="nt">-moz-box-sizing</span><span class="o">:</span> <span class="nt">border-box</span><span class="o">;</span> <span class="c">/* Firefox, other Gecko */</span> </span><span id="L-5"><a name="L-5"></a><span class="nt">box-sizing</span><span class="o">:</span> <span class="nt">border-box</span><span class="o">;</span> <span class="c">/* Opera/IE 8+ */</span> </span><span id="L-6"><a name="L-6"></a> </span><span id="L-7"><a name="L-7"></a><span class="nt">Not</span> <span class="nt">supported</span> <span class="nt">in</span> <span class="nt">IE6</span> <span class="nt">and</span> <span class="nt">IE7</span> </span></pre></div> </td></tr></table>
box, css, model