0
0
Tailwindmarkup~5 mins

Arbitrary color values in Tailwind - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What are arbitrary color values in Tailwind CSS?
Arbitrary color values let you use any color you want by writing it directly inside square brackets, like <code>bg-[#123abc]</code>. This means you are not limited to Tailwind's default colors.
Click to reveal answer
beginner
How do you write a background color using an arbitrary hex color in Tailwind?
You write the class like this: <code>bg-[#ff6347]</code>. This sets the background color to the hex color #ff6347 (tomato red).
Click to reveal answer
intermediate
Can you use arbitrary color values with opacity in Tailwind CSS? How?
Yes! You can add opacity by using RGBA or HSLA colors inside the brackets, for example: bg-[rgba(255,99,71,0.5)] sets a semi-transparent tomato background.
Click to reveal answer
beginner
Why might you choose arbitrary color values over Tailwind's default palette?
Sometimes you need a very specific color that Tailwind does not include. Arbitrary values let you use any color code you want without changing Tailwind's config.
Click to reveal answer
beginner
What is the correct syntax to use an arbitrary color value for text color in Tailwind?
Use text-[color] with your color inside brackets. For example, text-[#4caf50] sets the text color to a green shade.
Click to reveal answer
How do you apply a custom background color #1a2b3c using Tailwind's arbitrary value syntax?
Abg-[#1a2b3c]
Bbg-#1a2b3c
Cbackground-[#1a2b3c]
Dbg{#1a2b3c}
Which of these is a valid way to set semi-transparent red background using arbitrary values?
Abg-rgba(255,0,0,0.5)
Bbg-[rgba(255,0,0,0.5)]
Cbg-[#ff000080]
Dbg-opacity-50-red
Why use arbitrary color values in Tailwind CSS?
ATo use colors outside the default palette
BTo write CSS without classes
CTo disable Tailwind colors
DTo create animations
Which is the correct class to set text color to #123abc in Tailwind?
Acolor-#123abc
Btext-#123abc
Ctext-[#123abc]
Dtext{#123abc}
Can you use named CSS colors like 'rebeccapurple' as arbitrary values in Tailwind?
AOnly if configured in Tailwind config
BNo, only hex colors allowed
COnly with RGB values
DYes, like bg-[rebeccapurple]
Explain how to use arbitrary color values in Tailwind CSS and why they are useful.
Think about how you can write any color code inside Tailwind classes.
You got /4 concepts.
    Describe how to set a semi-transparent background color using arbitrary values in Tailwind.
    Remember opacity can be included in rgba or hsla colors.
    You got /4 concepts.