Skip to content

Courses / CSS3 Mastery: Beginner to Advanced / Modern CSS Functions

2,092 people viewed this

Modern CSS Functions

Start with a usable base style, then enhance it with modern features when available. Test actual target browsers, keep fallbacks simple, and avoid unnecessary duplication.

Practice Exercise

Create a reusable card component using custom properties, native nesting, logical padding and margins, a fluid width, and an @supports enhancement. Test a right-to-left text direction.

Quiz — 10 MCQs

  1. What does var() retrieve? (A) A custom property value (B) An HTML tag (C) A database field automatically (D) A JavaScript function result. Answer: A. Var references CSS custom properties.
  2. What does the ampersand mean in native CSS nesting? (A) The parent selector in nested selector patterns (B) A database join (C) A color format (D) A URL. Answer: A. The nesting selector represents the parent selector.
  3. What does padding-inline control? (A) Padding on inline-start and inline-end (B) Only the physical top side (C) Font size (D) Background color. Answer: A. It controls the two sides of the inline axis.
  4. What does padding-block control? (A) Block-start and block-end padding (B) Only physical left padding (C) Font family (D) Grid tracks. Answer: A. It sets padding along the block axis.
  5. Why use logical properties? (A) To adapt to writing modes and direction (B) To remove accessibility (C) To disable the cascade (D) To prevent all margins. Answer: A. They align styles with logical axes rather than fixed physical sides.
  6. What does writing-mode affect? (A) Text flow orientation and block/inline axes (B) Server settings (C) Database encoding only (D) Font downloads only. Answer: A. Writing mode defines the orientation of lines and axes.
  7. What does @supports do? (A) Tests CSS feature support (B) Defines HTML structure (C) Creates a database (D) Replaces media queries in all cases. Answer: A. It conditionally applies styles based on feature support.
  8. What is a fallback in var(--color, blue)? (A) blue, if the custom property cannot provide a usable value (B) Always the first value (C) A selector (D) A media query. Answer: A. The second argument is the fallback value.
  9. What is progressive enhancement? (A) Start with a usable base and add supported enhancements (B) Require the newest browser for all content (C) Remove all fallback styles (D) Use only inline CSS. Answer: A. Core functionality remains usable while supported features enhance it.
  10. What does text-wrap: balance aim to improve? (A) The balance of line lengths, especially in headings (B) Database normalization (C) Border radius (D) Image aspect ratio. Answer: A. It can improve visual line balance in supported browsers.

Key Takeaways

  • Use custom properties for reusable design values.
  • Native nesting groups related rules.
  • Logical properties improve internationalized layouts.
  • Use feature queries and progressive enhancement for modern CSS.

Rate this course

No ratings yet — yours can be the first.

Stars show on this course. Your written note stays private.

Your stars