When you need a one-off value that isn't part of your design tokens, use square brackets: w-[350px], bg-[#071A2F], or top-[17px].
Tailwind Arbitrary Values
Apply custom pixel or hex values on the fly with square bracket syntax [value].
Key Takeaways: Tailwind Arbitrary Values
Mastering Tailwind Arbitrary Values helps you write clean and reliable Tailwind CSS code. Follow standard conventions, test edge cases, and keep logic simple. Try running the code example below and complete the exercises to build confidence.
Tailwind Arbitrary Values Code Example
Tailwind CSS<div class="w-[320px] h-[120px] bg-[#071A2F] text-white p-[14px] rounded-[18px]">
Custom dimensions and exact hex color.
</div>
Output
Renders styled container with exact arbitrary values
Free sign-in required · Google login available
Finished this lesson?
Mark it complete to track your progress.
Stuck on something?
Ask the community in the CodesInTech forum.
Need a developer?
Learning on your own is great — and when you need professional help, our team builds custom software, websites and mobile apps for clients worldwide.
Explore Our Services