<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Box Model on Simple Enough Blog</title><link>https://blog-dev.simpleenough.net/tags/box-model/</link><description>Recent content in Box Model on Simple Enough Blog</description><generator>Hugo</generator><language>en</language><lastBuildDate>Mon, 04 Aug 2025 16:09:45 +0200</lastBuildDate><atom:link href="https://blog-dev.simpleenough.net/tags/box-model/index.xml" rel="self" type="application/rss+xml"/><item><title>Understanding the CSS Box Model</title><link>https://blog-dev.simpleenough.net/blog/boxmodel/</link><pubDate>Mon, 04 Aug 2025 16:09:45 +0200</pubDate><guid>https://blog-dev.simpleenough.net/blog/boxmodel/</guid><description>&lt;h2 id="i-what-is-the-css-box-model" class="heading">I. What is the CSS Box Model?&lt;a href="#i-what-is-the-css-box-model" aria-labelledby="i-what-is-the-css-box-model">
&lt;!-- &lt;i class="fas fa-link anchor">&lt;/i> -->
 &lt;svg class="svg-inline--fa fas fa-link anchor" fill="currentColor" aria-hidden="true" role="img" viewBox="0 0 640 512">&lt;use href="#fas-link">&lt;/use>&lt;/svg>&amp;nbsp;
 &lt;/a>
&lt;/h2>
&lt;p>In CSS, &lt;strong>every HTML element is treated as a rectangular box&lt;/strong>. This is called the &lt;strong>box model&lt;/strong>.&lt;/p>
&lt;p>The box model defines &lt;strong>how an element&amp;rsquo;s total size is calculated&lt;/strong>, and how it interacts with surrounding elements.&lt;/p>
&lt;p>An HTML element consists of &lt;strong>4 main areas&lt;/strong>:&lt;/p>
&lt;div class="mb-3 syntax-highlight">&lt;pre tabindex="0">&lt;code>+-------------------------------+
| margin (outer) |
| +-------------------------+ |
| | border (border) | |
| | +-------------------+ | |
| | | padding (space) | | |
| | | +---------------+ | | |
| | | | content | | | |
| | | +---------------+ | | |
| | +-------------------+ | |
| +-------------------------+ |
+-------------------------------+&lt;/code>&lt;/pre>&lt;/div>&lt;hr>




&lt;h2 id="ii-the-4-parts-of-the-box-model" class="heading">II. The 4 Parts of the Box Model&lt;a href="#ii-the-4-parts-of-the-box-model" aria-labelledby="ii-the-4-parts-of-the-box-model">
&lt;!-- &lt;i class="fas fa-link anchor">&lt;/i> -->
 &lt;svg class="svg-inline--fa fas fa-link anchor" fill="currentColor" aria-hidden="true" role="img" viewBox="0 0 640 512">&lt;use href="#fas-link">&lt;/use>&lt;/svg>&amp;nbsp;
 &lt;/a>
&lt;/h2>




&lt;h3 id="1-content" class="heading">1. &lt;code>content&lt;/code>&lt;a href="#1-content" aria-labelledby="1-content">
&lt;!-- &lt;i class="fas fa-link anchor">&lt;/i> -->
 &lt;svg class="svg-inline--fa fas fa-link anchor" fill="currentColor" aria-hidden="true" role="img" viewBox="0 0 640 512">&lt;use href="#fas-link">&lt;/use>&lt;/svg>&amp;nbsp;
 &lt;/a>
&lt;/h3>
&lt;p>The &lt;strong>actual content&lt;/strong> of the element (text, image, button…).&lt;/p></description></item></channel></rss>