0
0
Tailwindmarkup~5 mins

Square bracket notation for custom values in Tailwind - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is square bracket notation in Tailwind CSS?
Square bracket notation lets you use custom CSS values directly in Tailwind classes, like bg-[#ff6347] for a custom background color.
Click to reveal answer
beginner
How do you write a custom width of 37 pixels using square bracket notation?
You write it as w-[37px]. This tells Tailwind to apply a width of exactly 37 pixels.
Click to reveal answer
intermediate
Can you use square bracket notation for any CSS property in Tailwind?
Yes, as long as Tailwind supports that property, you can use square brackets to add any valid CSS value, like text-[1.25rem] or mt-[10vh].
Click to reveal answer
beginner
Why is square bracket notation useful in Tailwind CSS?
It lets you quickly add unique styles without editing config files or writing extra CSS, keeping your code simple and fast.
Click to reveal answer
beginner
Example: What does text-[20px] do in Tailwind?
It sets the font size to exactly 20 pixels, overriding default sizes.
Click to reveal answer
How do you set a custom background color #123abc using Tailwind's square bracket notation?
Abg-#123abc
Bbg{123abc}
Cbg(123abc)
Dbg-[#123abc]
Which of these is a valid Tailwind class for a custom margin of 15 pixels?
Am-[15px]
Bmargin-15px
Cm-15
Dm(15px)
Can you use square bracket notation to set a custom font size of 2rem?
AYes, use <code>text-[2rem]</code>.
BNo, Tailwind only allows predefined sizes.
CYes, but only in the config file.
DNo, you must write custom CSS.
What happens if you write w-[50] without units in Tailwind?
AIt sets width to 50 percent.
BIt sets width to 50 pixels.
CIt causes an error or is ignored.
DIt sets width to 50 em.
Which Tailwind class sets a custom padding of 3.5rem using square bracket notation?
Apadding-3.5rem
Bp-[3.5rem]
Cp-3.5
Dp(3.5rem)
Explain how square bracket notation works in Tailwind CSS and why it is helpful.
Think about how you add unique styles without extra CSS files.
You got /4 concepts.
    Give three examples of Tailwind classes using square bracket notation for different CSS properties.
    Use brackets with values like colors, px, rem units.
    You got /3 concepts.