<p><a href="/daily/2023/01/02/dont-use-arbitrary-values-in-tailwind-css">I generally don't use aritrary classes with Tailwind CSS</a>.</p>
<p>But, they are powerful, and I do use them in some situations.</p>
<p>A few months ago, <a href="https://x.com/opdavies/status/1755332703308652730">I posted a screenshot of a timeline component</a> I've built for a client project.</p>
<p>Today, I needed to fix an issue with the first and last "paths" as they were stretching further than they should.</p>
<p>This is the class I added to fix the problem:</p>
<p>It adds an arbitrary amount of right margin, which is 50% of the container minus half of the path width, which is the <code>--path-width</code> variable.</p>
<p>This class uses the <code>calc</code> function as well as <code>var</code> to determine the correct margin to apply, whilst keeping the code adaptable in case the path width changes.</p>
<p>And, as this is a value that's only used in this component, there's no benefit to writing this in a stylesheet - making an arbitrary value was a good option.</p>
<p>But, they are powerful, and I do use them in some situations.</p>
<p>A few months ago, <a href="https://x.com/opdavies/status/1755332703308652730">I posted a screenshot of a timeline component</a> I've built for a client project.</p>
<p>Today, I needed to fix an issue with the first and last "paths" as they were stretching further than they should.</p>
<p>This is the class I added to fix the problem:</p>
<p>It adds an arbitrary amount of right margin, which is 50% of the container minus half of the path width, which is the <code>--path-width</code> variable.</p>
<p>This class uses the <code>calc</code> function as well as <code>var</code> to determine the correct margin to apply, whilst keeping the code adaptable in case the path width changes.</p>
<p>And, as this is a value that's only used in this component, there's no benefit to writing this in a stylesheet - making an arbitrary value was a good option.</p>