Pratham Profile picture
27 May, 16 tweets, 4 min read
Introduction to CSS transitions ⏲️

CSS transition add some smoothness in animation. By using it, you can change styling over a given duration instead of instantly

Let's discuss this in a little more detail 🧵👇🏻
CSS transition and CSS animation are two closely related modules of CSS but they are different

For example, CSS animation runs automatically but the transition need to be triggered like hover
Transition is a like a two point operation. For example, suppose you're changing the height to an element when user hover it from 100px to 200px

In this case point A is 100px and point B is 200px
Learning CSS transition is not really difficult, you just need to learn four properties and that's it

transition-delay
transition-duration
transition-property
transition-timing-function
📌 transition-property

transition-property defines the name of CSS property/ies to which transition should be applied.
📌 transition-duration

Transition duration is nothing but the time period in which transition occurs.

Let's try to play around with these two properties 👇🏻
Consider this code snippet 🔽

div {
transition-property: height;
transition-duration: 2s;
}

div:hover {
height: 200px;
}

The output 👇🏻
Explanation:

Point A - height 100px
Point B - height 200px;

The div element changing its height from 100 to 200px in 2 seconds as mentioned in transition-duration property
Alright moving further, we can add multiple CSS properties in transition-property and multiple transition-duration as well using comma(,) separated values

div {
transition-property: height, width;
transition-duration: 2s 4s;
}

div:hover {
height: 200px;
width: 200px;
}
You can see height is changing is 2s and width in 4s as we have mentioned it respectively.

If in case there is only one value is transition-duration then it will applicable for all the properties mentioned in transition-property
📌 transition-delay

As the property name suggests, it defines how long to wait between the time a property is changed and the transition actually begins.
📌 transition-timing-function

The transition-timing-function property specifies the speed curve of the transition effect. Let's visualize it in next tweet
You can pass following values in transition-timing-function property

- ease (slow start, then fast, then slow)
- linear (same speed)
- ease-in (slow start)
- ease-out (slow end)
- ease-in-out (slow start and slow end)
- cubic-bezier (customizable)
You can visualize all the curves here on the link

🔗 codepen.io/prathkum/pen/Q…
Instead of using four diffrent transition property you can use only one CSS shorthand property called transition
And I think that's it for the CSS transition introduction, if you like this thread share it with you connectios, means a lot to me ❤️

I just launched a CSS notes books covering all my handwritten notes. Buy from here 👇🏻

gum.co/css-cheat

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Pratham

Pratham Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @Prathkum

29 May
Here is a quick glimpse of the JavaScript notes that I plan to include in the second edition of my Cheat Sheet book.

Be ready 🧵👇🏻
1. JavaScript Function Anatomy Image
2. JavaScript Array Methods Image
Read 6 tweets
29 May
5 great tools to test website for every web developer

🧵👇 Image
1. SEO Site Checkup

- SEO Site Checkup runs through a fast audit of your site, checking for proper tags and surfacing any errors that might come up

🖇️ seositecheckup.com Image
2. Web Page Test

- Run a free website speed test from around the globe using real browsers at consumer connection speeds with detailed optimization recommendations.

🖇️ webpagetest.org Image
Read 6 tweets
27 May
Announcement 🚨

You all have been waiting for this for so long. I just published my eBook containing all my CSS cheat sheets.

Sounds good? Purchase it right now for $1 only 💸

🔗 gum.co/css-cheat
People are suggesting me that $ 1 is too low 😅

I was going to keep its price $0. Thank god i didn't do that. Still, I love helping others as much as I can. If you can't spend $1 due to some reasons, DM me and I'll send you a free copy ❤️
Unbelievable for me 🚀
Read 5 tweets
27 May
These 5 great tools can save you from writing CSS code if you're a front-end developer

🧵👇🏻
1️⃣ CSS Accordion Slider Generator

- Create fully responsive, css only accordion sliders

🔗 accordionslider.com
2️⃣ Animate.css

- Animate is a CSS library for basic CSS animation. Its a browser friendly with a lot of pre built animations

🔗 animate.style
Read 6 tweets
26 May
Cool things about HTML in this single thread 🧵👇🏻
2. Types of list marks
Read 11 tweets
26 May
5 great code snippet websites for every web developer and designer

🧵👇🏻
1️⃣ 30 Seconds of Code

- Short code snippets for all your development needs

🔗 30secondsofcode.org
2️⃣ Free Frontend

- Free hand-picked HTML, CSS and JavaScript (jQuery, React, Vue) code examples, tutorials and articles

🔗 freefrontend.com
Read 6 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!

Follow Us on Twitter!

:(