0
0
Tailwindmarkup~20 mins

Arbitrary properties for unsupported CSS in Tailwind - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Tailwind Arbitrary Properties Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
📝 Syntax
intermediate
2:00remaining
Using arbitrary properties in Tailwind CSS
Which of the following Tailwind CSS classes correctly applies a CSS property scroll-margin-top with a value of 2rem using arbitrary properties?
Ascroll-margin-top:2rem
Bscroll-margin-top-[2rem]
C[scroll-margin-top:2rem]
Dscroll-margin-top(2rem)
Attempts:
2 left
💡 Hint
Remember that arbitrary properties in Tailwind use square brackets with the full CSS property and value inside.
rendering
intermediate
2:00remaining
Visual effect of arbitrary CSS property in Tailwind
Given the following HTML snippet styled with Tailwind CSS, what visual effect will the class [scroll-padding-top:4rem] have when the user scrolls to an anchor link inside the page?
Tailwind
<nav class="fixed top-0 w-full bg-white shadow">
  <a href="#section1" class="block p-4">Section 1</a>
</nav>
<main class="pt-16 [scroll-padding-top:4rem]">
  <section id="section1" class="h-screen bg-gray-100">Content</section>
</main>
AThe page will scroll so the top of #section1 is 4rem below the viewport top, avoiding overlap with the fixed nav.
BThe page will scroll normally with #section1 at the very top of the viewport, overlapping the fixed nav.
CThe page will add 4rem of padding inside #section1, pushing content down visually.
DThe page will not scroll at all when clicking the anchor link.
Attempts:
2 left
💡 Hint
Scroll padding controls the offset when scrolling to anchors, useful with fixed headers.
selector
advanced
2:00remaining
Combining arbitrary properties with pseudo-classes in Tailwind
Which Tailwind CSS class correctly applies backdrop-filter: blur(5px) only when the element is hovered?
Ahover:backdrop-filter(blur(5px))
B[hover:backdrop-filter:blur(5px)]
C[backdrop-filter:hover:blur(5px)]
Dhover:[backdrop-filter:blur(5px)]
Attempts:
2 left
💡 Hint
In Tailwind, pseudo-classes come before the arbitrary property in the class name.
accessibility
advanced
2:00remaining
Accessibility considerations when using arbitrary CSS properties
When using arbitrary CSS properties like [scroll-margin-top:3rem] in Tailwind, which accessibility best practice should you keep in mind?
AEnsure the offset does not hide focused elements or cause keyboard navigation confusion.
BAlways add <code>aria-hidden="true"</code> to elements with arbitrary properties.
CAvoid using arbitrary properties because screen readers do not support them.
DUse arbitrary properties only on decorative elements without interactive content.
Attempts:
2 left
💡 Hint
Think about how scrolling and focus work for keyboard users.
🧠 Conceptual
expert
3:00remaining
Why use arbitrary properties in Tailwind CSS?
Which statement best explains the main advantage of using arbitrary properties like [text-shadow:2px_2px_4px_rgba(0,0,0,0.5)] in Tailwind CSS?
AThey enable JavaScript to dynamically change CSS properties without reloading the page.
BThey allow applying any CSS property value without needing to extend Tailwind's config or write custom CSS files.
CThey replace the need for semantic HTML elements by styling everything inline.
DThey automatically optimize CSS for better performance and smaller file size.
Attempts:
2 left
💡 Hint
Think about flexibility and avoiding extra setup.