using transition duration on all elements

so this is a general question I don't have a problem with it but wouldn't be better if we use *{ transition-duration: time; } so we can just put the transition on everything or will that break the website in some kind of way I see myself using the transition duration on lots of stuff and it's overall good to have to change colors or size
8 Replies
Joao
Joao3y ago
I asked something similar once here: https://discord.com/channels/436251713830125568/994742366051242064/994742903182213281 Basically, it may cause performance issues the larger the application. I finally decided to not be lazy and apply the selectors only where needed 😄 It may be particularly noticeable if you have interactive elements coming in and out of view, like modals or infinite scrolling, since those elements would have more to compute as soon as they are placed in the DOM even if they don't really use it.
ABK | Muneer
ABK | MuneerOP3y ago
ah i see i thought it would've count as 1 line of code since i use the * didn't think it would have performance issues and was wondering if it's better since even when you resize stuff it just looks better with a transition duration not just go right away
Joao
Joao3y ago
You can still just try it out and see if it works for your case. But consider lower-end devices that can't handle graphics very well, that's where it will be more obvious the stutter in the animation Or you could use JavaScript to dynamically add and remove a particular class with that rule on resize events. That sounds like a lot of work though
ABK | Muneer
ABK | MuneerOP3y ago
i'm reading your post as well it have some answers to my question and is really interesting
Joao
Joao3y ago
Always good to ask when in doubt 👍 Another idea that comes to mind if you really want to have that animation on resize is to use a particular css class, and apply that on main elements. And by main I mean anything you think it's interesting to watch transitioning, like articles or headlines
ABK | Muneer
ABK | MuneerOP3y ago
well thank you for the help ! now i have more knowledge than before
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
ABK | Muneer
ABK | MuneerOP3y ago
good point
Want results from more Discord servers?
Add your server