0
0
Tailwindmarkup~5 mins

Custom spacing scale in Tailwind - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a custom spacing scale in Tailwind CSS?
A custom spacing scale in Tailwind CSS is a set of user-defined size values that replace or extend the default spacing sizes for margins, padding, gaps, and other spacing utilities.
Click to reveal answer
beginner
How do you define a custom spacing scale in Tailwind CSS?
You define a custom spacing scale by editing the theme.extend.spacing section in the tailwind.config.js file, adding your own key-value pairs for spacing sizes.
Click to reveal answer
intermediate
Example: What does this spacing scale entry mean? <br>spacing: { '72': '18rem' }
It means you can use 72 as a spacing size in Tailwind classes, and it will apply a size of 18rem (which is 18 times the root font size). For example, p-72 adds padding of 18rem.
Click to reveal answer
intermediate
Why use a custom spacing scale instead of default Tailwind spacing?
Custom spacing scales let you match your design system exactly, keep consistent spacing, and avoid arbitrary values. It helps maintain a clean, scalable, and easy-to-update style.
Click to reveal answer
beginner
How do you apply a custom spacing value in your HTML using Tailwind?
After defining a custom spacing key like 84: '21rem', you use it in classes like m-84 for margin or p-84 for padding. Tailwind replaces it with the defined size.
Click to reveal answer
Where do you add custom spacing values in Tailwind CSS?
AInside <code>theme.extend.spacing</code> in <code>tailwind.config.js</code>
BIn your HTML file inside <code>&lt;style&gt;</code> tags
CIn the <code>package.json</code> file
DIn the browser DevTools console
What unit is commonly used for custom spacing values in Tailwind?
ARem (root em)
BDegrees (deg)
CPercent (%)
DPixels (px)
If you add '100': '25rem' to spacing, how do you use it in your HTML?
A<code>p-25rem</code>
B<code>m-100</code>
C<code>spacing-100</code>
D<code>padding-25rem</code>
What happens if you use a spacing class not defined in your custom scale or default Tailwind?
AThe spacing doubles automatically
BTailwind applies a default size
CThe browser shows an error
DThe class is ignored and no spacing is applied
Why is it better to extend spacing instead of replacing it in Tailwind config?
AReplacing is faster but less flexible
BExtending removes all default spacing
CExtending keeps default sizes and adds yours
DReplacing is required for custom spacing
Explain how to create and use a custom spacing scale in Tailwind CSS.
Think about where Tailwind stores its design tokens and how you apply spacing classes.
You got /4 concepts.
    Why is using a custom spacing scale helpful for consistent web design?
    Consider how designers keep their work neat and easy to maintain.
    You got /4 concepts.