snipt

Ctrl+h for KB shortcuts

CSS

Natural box style

1
2
3
4
/* apply a natural box layout model to all elements */
* { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; }

/* paulirish.com/2012/box-sizing-border-box-ftw/ */
https://snipt.net/embed/15dbbdd06a377e4b5d02aa5bea7e1e05/
/raw/15dbbdd06a377e4b5d02aa5bea7e1e05/
15dbbdd06a377e4b5d02aa5bea7e1e05
css
CSS
4
2019-08-19T21:12:31
True
False
False
/api/public/snipt/41946/
natural-box-style
<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></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="c">/* apply a natural box layout model to all elements */</span> </span><span id="L-2"><a name="L-2"></a><span class="o">*</span> <span class="p">{</span> <span class="o">-</span><span class="n">moz</span><span class="o">-</span><span class="n">box</span><span class="o">-</span><span class="n">sizing</span><span class="o">:</span> <span class="nb">border</span><span class="o">-</span><span class="n">box</span><span class="p">;</span> <span class="o">-</span><span class="n">webkit</span><span class="o">-</span><span class="n">box</span><span class="o">-</span><span class="n">sizing</span><span class="o">:</span> <span class="nb">border</span><span class="o">-</span><span class="n">box</span><span class="p">;</span> <span class="n">box</span><span class="o">-</span><span class="n">sizing</span><span class="o">:</span> <span class="nb">border</span><span class="o">-</span><span class="n">box</span><span class="p">;</span> <span class="p">}</span> </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a><span class="c">/* paulirish.com/2012/box-sizing-border-box-ftw/ */</span> </span></pre></div> </td></tr></table>
border-box, margin, padding, width