HTML & CSS · Senior · Question 54 of 75

What problem does @starting-style solve?

.toast { opacity: 1; transition: opacity 0.3s, display 0.3s allow-discrete; }
@starting-style { .toast { opacity: 0; } }

Explanation

Without a starting style, newly displayed elements render directly in their final state. Combined with transition-behavior: allow-discrete, enter and exit animations work in pure CSS.

Further reading

Problem with a question

HTML & CSS · Senior · question 54

Test yourself

Take the HTML & CSS · Senior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz