Use transition-colors and transition-shadow together
#19249
Replies: 2 comments 7 replies
-
|
I guess this would be a breaking change, but maybe we could change transition to work like so: I think that would be similar to how box-shadow and gradient works. |
Beta Was this translation helpful? Give feedback.
-
|
CSS doesn't merge them. .transition-colors {
transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to;
transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
transition-duration: var(--tw-duration, var(--default-transition-duration));
}
.transition-shadow {
transition-property: box-shadow;
transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
transition-duration: var(--tw-duration, var(--default-transition-duration));
}TailwindCSS can't interfere with your source code or decide to rewrite it for you so that you don't use those two CSS classes. And the CSS classes each have only one property. CSS could provide something like that, but then it would also need to check whether each declaration is actually necessary. .transition-colors {
transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to;
transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
transition-duration: var(--tw-duration, var(--default-transition-duration));
}
.transition-shadow {
transition-property: box-shadow;
transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
transition-duration: var(--tw-duration, var(--default-transition-duration));
}
/*
That would actually make sense, I'm just not sure how feasible the merge would be.
Just an example what you want:
.transition-colors.transition-shadow {
transition-property: box-shadow, color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to;
transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
transition-duration: var(--tw-duration, var(--default-transition-duration));
}
*/But you still have every option to extend the value of |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
-
Currently, if I want to transition a background-color, I use
transition-colors.And if I want to transition a box-shadow, I use
transition-shadow.But what if I want both ? There is no easy way to combine them...
I could:
transition-all, but it has the side effect of animating the padding/margin when I go from mobile to desktop for example.transition-[background-color,box-shadow], but this would omit all the other property fortransition-colors, likecolor, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to;.Why doesn't Tailwindcss doesn't let us combine them like so
class="transition-colors transition-shadow"like we can with other property ?Beta Was this translation helpful? Give feedback.
All reactions