Customizable typewriter animation with CSS

Kevin Powell · Beginner ·🌐 Frontend Engineering ·5y ago

Key Takeaways

This video demonstrates how to create a customizable typewriter animation using CSS, utilizing custom properties, pseudo-elements, and keyframe animations to achieve a realistic effect. The animation is customizable in terms of speed, text, and style, making it a versatile tool for web development.

Full Transcript

so the other day to avoid doing work i was scrolling through twitter as probably do way too often and as i was doing that i came across this tweet by prantham who made a css only typewriter uh effect and i thought it was really cool so of course instead of just looking at his code and getting back to work like i should do i thought to myself it would be fun to try and do that without looking at how he did it and seeing if i can pull it off so in this video we're going to be diving into how i did it and how you could integrate it into your own projects hello my friend and friends and welcome back to the channel if you are new here my name is kevin and here at my channel we learn how to embrace the cascade and just fall madly deeply in love with css by having a lot of fun with it sometimes we go deep into the fundamentals and other times we learn a lot like building fun things like this instead now one thing when i was creating this that i wanted to make sure of it was that it would be as customizable as possible and my idea with it is i would make it work for me but i also want to make it easy for you to integrate into your own projects so we can adjust the speed of it really really easily with one custom property being updated if you change the text that's inside of it you can also update that really really easily everything is just always gonna be working you don't have to like fiddle around with it and try and fight with it or anything like that you don't have to get javascript to start figuring out the widths of things or anything you should be able to just throw it in there and get it to work so i'm pretty happy with how this turned out i did have to check out pranthom's a couple times not so much for the code but to make it look as good as his look to get like the the timing of things down as we'll see so a really big thank you to him for for posting that tweet that inspired all of this and i would definitely i put his link to his twitter down there because if you're not following him and you do enjoy css he's just always dropping really awesome css stuff continually over on twitter so go give him a follow if you aren't already now let's go and dive into this video and see how i managed to get this done all right so we are here in vs code and there are a few very important things or one very important thing to start with is whatever text you want to be doing this on it ideally it should be kind of short but you will also need to have a right here a mono space font on there so i'm using source code pro from google fonts it must be a goo it must be a mono space font because if the letters have different sizes to it this whole thing just collapses very quickly so that is one thing now luckily that goes really well with what we need other than that you don't need too much you can see i just have an h1 here that says hello my name is kevin and that's all we need for this type of thing to happen so what we're going to do is there's other approaches you can use for this for sure but what i'm going to do is i'm going to be using befores and afters to pull this off and if you know me at all you know i love my pseudo-elements if you're not comfortable with them i would really strongly suggest that you do get comfortable with them i do have a card popping up right there that goes into how pseudo elements work just because it is a really big part of how i'm going to be doing this um so yeah just so you're not left a little bit confused by how it's happening that could really help you out if you want to just keep on going see if you can get it working and then check out that video later it will be also linked down in the description below um so with suit elements you do need to have a content property on them and so that's going to help and for now i'm going to give them a background or we should give them different color backgrounds so i'll separate that out actually and i just like doing that so we can actually see what we're working with um i'm i'm gonna give them all we might change a little bit of this but for now we're gonna do a top a right of zero a bottom of zero and a left of zero and of course if you're doing all this you should be putting a position on them so we'll do a position absolute now i don't want this to be absolute for the whole page i want it to be relative to my h1 so we'll give this a position of relative to make sure that the h1 is the containing block right there we're gonna we'll just do with one of these for now so one of them we can't see them yet but let's say my h1 before we'll start with that one and uh we'll just give this a background background of let's go with teal just so it's something we can see it actually goes kind of nice with that color so we can see it's come into place and now we'll be able to play with it while we see what we're doing and then we can make you know change it afterward to be able to hide it away and ideally what we want is we actually want it to start like this and then slowly disappear away so it's revealing the characters that are underneath it and so to be able to do that what i'm going to do is come here and write key frames i'm going to write a type type uh typewriter and i would say typewriter i guess that makes sense um and we're just gonna say two and so we want this to start here and we want it to move all the way across we want this to go um to the left of one hundred percent and that means the left is gonna move away like a hundred percent away um from where it was now we shouldn't see anything yet but what we'll do now is we'll come on here and this is we just want to make sure that this is doing what we want it to animation so we'll say uh the animation we want is typewriter we want it to say last we'll just do one second for now and we'll do an ease just because why not and there so you can see as that time goes on it reveals the text that's underneath it that's a start but obviously it doesn't look great right now also one of them is it's probably a little bit too fast we don't really want it to be using an ease because we don't want to reveal it like that and the easiest thing to fix here is if we write forwards at the end it means once the animation runs it won't cover it again it doesn't go back to the starting position it stays at the end like this last part here um you will notice i didn't put a starting point i've only put an ending point on this if the starting point is the same as whatever your initial property would be anyway so like you've declared something here you don't have to declare that um in the the animation itself i learned that from jay so if you don't know jay i'll put a link to his twitter um in the description he's a css genius that does all sorts of crazy crazy crazy stuff with css so recommend you check them out the okay so if let's just watch that again we'll refresh and we can see it's revealing it that way now what we want to do is instead of doing it we can use one second actually let's just make it a little bit longer because i think one second is going to be kind of fast so we can slow it down um and instead of using an ease here and just to make it a bit easier i'm going to put this on its own line just so we can see the different things we're doing actually prettier might fix this but that's okay what we want to write here is actually write steps and then how many steps do we want it to take now this is the one thing where javascript maybe could do something that i can't do here with css and let's know how many characters i have in the text here so we just have to count them so we have one two three four 22 23 24 including the period and including all the spaces so my steps is going to be 24. let's hit save and let's watch what happens now that's kind of cool that's just cool on its own right so basically what we're saying is i want my typewriter animation so we're moving it from a left of zero to a left of a hundred percent and just in case you're wondering i'm always saying not to do animations using um positioning like the top left right i'm usually saying to use things like sk transforms with scales and stuff like that because we don't need a buttery smooth 60 frames per second animation for this it's going in steps it doesn't really matter and i think this is the easiest way to do it so that's why i'm doing it like this um so we get 24 steps and again this really depends on the the text that you have how long your name is and all of that but we can see that it is revealing everything right there and you can see it's doing one letter at a time and actually i just i just thought of something that it is possible this is sort of happening a little bit because i have a grid set up on my body and my h1 is part of that uh i'll show you a thing you see right now i broke it now um so if you're not set up in this exact situation you might run into this where you get this problem where the default is like even though my h1 has a width uh or only has 24 characters in it it's a block level element the width is wanting to stretch and what happened here is i put it in a grid just to center it on the screen but that had the consequence of it actually shrinking the size of it but what you can do to actually get that behavior by default is if you go on your h1 let's just give this an outline so we can see it outline 2 pixels solid red and so now you can see that it has that full width to it what you can do is you can give this a width of max content and hit save and now it's going to shrink to fit the content that's inside of it without breaking that content so let's open up responsive mode here and you can see that like i've set this up with a clamp on my font size so the font's changing a little bit if you don't know about this which is absolutely the best there's a card popping up where i dive into how clamp works um for big fonts and for little and for things like this i think it's absolutely wonderful so the font will shrink down it does hit a minimum size though and you will get like some overflow that can happen from it uh that's why i said shorter text will work better on this and maybe a media query that turns it off like you don't have this type of animation on small screens if you can't prevent line breaks or something like that um it might be worth it so let's go and turn this back on uh just so we can keep it in the center of my screen so just sorry about that little tangent but i think it's an important one and the big advantage with that is actually you don't have to worry about the width of your element it's this is automatic this is going to work no matter how long or short it is you don't have to guess how many pixels or whatever it is you don't have to you know we have characters now so um you could use the character units i guess but um yeah that's working right there so let's turn off that outline and so we have this that's revealing everything and it's doing it that pace so now where the real magic can happen is we want this to have the same color background as my whatever background color it's on so i have come in with a custom property here and we're going to use custom properties a bit to make this a bit more customizable but we'll do this one custom property right here let's stick it on there and now it looks like it's being typed out because the color that's covering it is the same color as the background so it looks like it's coming out awesome i'm i'm super happy with that already i think that already looks pretty cool so next thing we want to do is get the little carrot thing that's going to be blinking away so for that we'll use our after so h1 after and for this one it's going to be a little bit different obviously but we can we can keep all of this on here i think um so let's let's come on my h1 after here let's just give it a width i'm going to do a .125 m and i'm using m because i use clamp my font size could change so that means that if the width of this if the font's changing i want the width of the carrot to grow and shrink with that font size so by using m there it's going to match the font size of my h1 so it can adapt to that and we'll give it a background of black because i think that makes sense and there we go we have a carrot it's in place it's just not doing anything too fancy yet so the first thing i'm actually going to do on this is we're going to use the same animation that we already did so let's just paste that on there and let's hit save and now you can see that it's it's working and this is kind of interesting and you might be wait kevin how's it working um and basically it's following the same the exact same thing and but just because the left side of it is being pushed along even though we've set a width on it it has the the width but it also has that left so the left positioning is being pushed along at the same pace that the other one is because they both have the same speed and all that on it so i think that's kind of cool so you can see it looks like it's sort of following as it's being typed out now there is one thing here is if you want to adjust the speed now it's kind of annoying it's in two places so this is i would come up here and we could come and say that we have my type writer speed speed and let's say and it looks a little i'm gonna put six seconds we're gonna slow things down a little bit so that just means here i could use this custom property of our um let's turn word wrap on for a sec var type type writer speed and of course we want that to be in both places so this four seconds could also get replaced by that and now it gets typed out right there as well and it's looking pretty good so yeah that's a good start but obviously we just have a black line that's moving it looks a lot more realistic if it's blinking so we will have to come up with another animation here so let's come at keyframes we'll just call it blink and for this one what we'll do is we're going to say a 2 and i'm just going to switch we're going to say background is transparent and so that means it's going to go from the black color that it was to a transparent color which will cause it to blink so if you didn't know this you can put multiple animations on something so here we have my typewriter animation let's turn word wrap off just so we can see it's on one line so we have typewriter i'll just make this bigger so we can see it a little easier so we have my typewriter with that animation and then i'm going to put a comma and we'll put a second one so the second one is blink and we're going to do i'll put the same speed on it for now we'll have to change this one though type writer speed we want the same steps so steps 24 and then we'll stick with four uh let's just put forwards and then we'll adjust it as we need to uh from here now it's not going to work perfectly as it is right now but let's hit save on that and see what it looks like and of course i just broke the entire thing oh you know why why because i didn't put an s here on forwards there we go so now it is working but you can see that you see how it's fading out fading out fading out fading out and then it gets to the transparency of zero uh so we don't want that so that's where i said the speed needs to be adjusted so this is this is how fast you want it to blink basically uh so let's try like 500 milliseconds and we can just adapt it from there uh of course now actually now it's disappeared here let's just put um instead of forwards i'm going to write infinite which means it can keep going over and over again instead of stopping at the end so there we go it's blinking away and actually maybe i would make that a little bit faster 350. uh 350. that looks terrible uh maybe 500 is okay actually we'll go back up to 500 but just because i'm looking at it here and it's going really really fast but i think what would really help this is before things start that we have like it's blinking over here before the typing starts um so what i would actually do is on the typewriter one itself i'm going to come after the steps and i'm going to put one second here and if i do that here this is a delay so i'm also going to have to put that one here i'll hit save so see how it's blinking already and then it starts typing it out now i definitely got that one from pratham's tweet i was looking at why his looked better than mine and uh it just that delay at the beginning made such a big difference so i think that's a really nice start and a really nice way just to add that sort of sense of realism before it starts typing out so like let's look at that again uh save come on refresh there we go so yeah just that delay before the typing starts i think it's a really nice sense it adds a really nice sense of realism to the whole thing and even you know the speed here maybe even as i was saying before i like that better there we go i found the speed that i like now 750 is what i'm going with you can obviously adjust this and this is somewhere where you could come up and set up a whole bunch of custom properties that are what are controlling this entire thing so that is one of the beauties of it and even you could put all like i'm putting these on my root you could put all these custom properties on the um within the h1 as well and just control the entire thing here you could come in and put the delay you could even have like we have typewriter speed we could also do a type typewriter calc um typewriter characters characters so in my case i have 24 characters but if the text were ever to change we could just update this custom property so that way your steps here we could should be able to come in and say var uh type writer characters and it should still work uh so here this should be characters not speed there we go so that's still working so you could come in and that way if you have a different your text changes you just come in and update that one place and you're updating all of these at the same time so that's definitely a really really handy um a way to make it a lot more customizable you could even use javascript then to update the custom property if you wanted to um that could be one way that you could approach it as well and i guess we'd want that to be right here as well because anywhere that was using the steps if we're using the custom property makes it easier to adjust now the one thing that's really busted with it for me right now is like this comes in like this text down at the bottom here is driving me nuts and like we shouldn't see welcome to my website then it types in it should be the other way around right we should see it type in and then that comes in so we're gonna do that really nice and fast i have my subtitle that is here right there and we're just gonna come in and create a new keyframes for that let's just move all of these down i guess we can keep all of our keyframes in one spot and what we'll do is we'll come in with another one we'll do key keyframes and we'll say fade in up like that and so this one's gonna be nice and easy we're gonna go to a opacity of one and a transform translate y because y is up and down of zero and because we want it to end where like at its finishing spot and that just means that on my subtitle we can come in with an opacity of zero and then we can come in with a transform translate y and we'll just move it down like i don't know 3 ram or something like that is that up or down we'll find out in a second and then we'll come in with our animation so my animation is going to be my fade in up we'll say it's over 500 milliseconds and we'll just throw an ease on there so there it is that's way too fast so let's do that at like two seconds and we'll do a forwards with an s on there and you can see it fades in and up so ha it was down when i did that one so that's perfect it looks great except now we need it to be delayed until the typing is finished so for that one once again we can come in with a custom property because remember this number if i put it if i don't put a number here there's no delay but we saw before we can add delays to our animations so here i want to do a delay that is the length this is going to take to be typed out plus probably a little bit more so let's just start by doing now remember we did our typewriter speed was a custom property that we came up with so we can make the delay the our var uh typewriter speed right there so let's hit save and we'll watch and so as soon as this finishes it should fade up and in there we go oh it was off by a little bit oh because we had a delay remember we had a delay at the beginning of it so we need to make it plus one second to make that actually be exact but i actually want it to be a little bit longer anyway so what i'm going to do is i'm going to take this whole thing or actually it's a start here where i have my variable and we're going to do a calc and i'm going to put it on its own line and we'll say calc we'll select all of this and so we have var calc of that speed so then we're going to do plus we'll say two seconds and hit save and so now if this works it should do the whole thing and about a second afterward it should come in uh there we go and if you like this video you'd probably really like this video right here where i built a neon button with a really cool glow that came underneath that glow just makes me smile every time i put it on it blurs out like that uh if not i put another custom playlist together here as well for you to check out a really big thank you to prantom for the inspiration for this as well as my enablers of awesome zack and randy as well as all my other patrons and until next time don't forget to make your corn on the internet just a little bit more awesome why did i just wear my earphones with no audio on for this entire video i don't know but i did

Original Description

After seeing a tweet from Prantham on Twitter (make sure to give him a follow: https://twitter.com/Prathkum) I wanted to make my own typewriter effect using only CSS! My goal with this was to make it as customizable as possible, so if you changed the text you could update it as quickly as possible using custom properties. 🔗 Links ✅ The code from this video: https://codepen.io/kevinpowell/pen/ExWZzmm ✅ If you're new to custom properties, watch this: https://youtube.com/playlist?list=PL4-IK0AVhVjOT2KBB5TSbD77OmfHvtqUi ✅ All about ::before and ::after : https://youtube.com/playlist?list=PL4-IK0AVhVjPBX_HelwDlNsTiyr2YGSBw ✅ min(), max(), and clamp(): https://youtu.be/U9VF-4euyRo ✅ Fun Glowing Neon Button effect: https://youtu.be/6xNcXwC6ikQ ✅ Other fun CSS effects: https://youtube.com/playlist?list=PL4-IK0AVhVjOJ-bvVtveuIOBffL3qSj64 ✅ Follow Jhey on Twitter for incredible CSS stuff: https://twitter.com/jh3yy ⌚ Timestamps 00:00 - Introduction 01:41 - Use a monospace font 02:19 - Setting the stage with pseudo-elements 03:55 - Animation to reveal the text 05:45 - Improving the animation with steps() 07:16 - Using max-content for the width 09:18 - Making the text look like it's being revealed 09:46 - Adding the caret 11:48 - The blinking animation 14:48 - Making it easier to customize 16:01 - Animating the other text #css -- Come hang out with other dev's in my Discord Community 💬 https://discord.gg/nTYCvrK Keep up to date with everything I'm up to ✉ https://www.kevinpowell.co/newsletter Come hang out with me live every Monday on Twitch! 📺 https://www.twitch.tv/kevinpowellcss --- Help support my channel 👨‍🎓 Get a course: https://www.kevinpowell.co/courses 👕 Buy a shirt: https://teespring.com/stores/making-the-internet-awesome 💖 Support me on Patreon: https://www.patreon.com/kevinpowell --- My editor: VS Code - https://code.visualstudio.com/ --- I'm on some other places on the internet too! If you'd like a behind the
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from Kevin Powell · Kevin Powell · 0 of 60

← Previous Next →
1 How to create an awesome navigation bar with HTML & CSS
How to create an awesome navigation bar with HTML & CSS
Kevin Powell
2 Improve your CSS by Keepin' it DRY
Improve your CSS by Keepin' it DRY
Kevin Powell
3 HTML & CSS for Beginners Part 6: Images
HTML & CSS for Beginners Part 6: Images
Kevin Powell
4 HTML & CSS for Beginners Part 7: File Structure
HTML & CSS for Beginners Part 7: File Structure
Kevin Powell
5 HTML & CSS for Beginners Part 4: Bold and Italic text and HTML comments
HTML & CSS for Beginners Part 4: Bold and Italic text and HTML comments
Kevin Powell
6 HTML & CSS for Beginners Part 5: Links
HTML & CSS for Beginners Part 5: Links
Kevin Powell
7 HTML & CSS for Beginners Part 3: Paragraphs and Headings
HTML & CSS for Beginners Part 3: Paragraphs and Headings
Kevin Powell
8 HTML and CSS for Beginners Part 1: Introduction to HTML
HTML and CSS for Beginners Part 1: Introduction to HTML
Kevin Powell
9 HTML and CSS for Beginners Part 2: Building your first web page!
HTML and CSS for Beginners Part 2: Building your first web page!
Kevin Powell
10 HTML & CSS for Beginner Part 8: Introduction to CSS
HTML & CSS for Beginner Part 8: Introduction to CSS
Kevin Powell
11 HTML & CSS for Beginners Part 9: External CSS
HTML & CSS for Beginners Part 9: External CSS
Kevin Powell
12 HTML & CSS for Beginners Part 10: Divs & Spans
HTML & CSS for Beginners Part 10: Divs & Spans
Kevin Powell
13 HTML & CSS for Beginners Part 11: Classes & IDs
HTML & CSS for Beginners Part 11: Classes & IDs
Kevin Powell
14 HTML & CSS for Beginners Part 12: The CSS Box Model - Margin, Borders & Padding explained
HTML & CSS for Beginners Part 12: The CSS Box Model - Margin, Borders & Padding explained
Kevin Powell
15 HTML & CSS for Beginners Part 13: Background Images
HTML & CSS for Beginners Part 13: Background Images
Kevin Powell
16 HTML & CSS for Beginners Part 14: Style Text with CSS
HTML & CSS for Beginners Part 14: Style Text with CSS
Kevin Powell
17 HTML & CSS for Beginners Part 15: How to style links
HTML & CSS for Beginners Part 15: How to style links
Kevin Powell
18 HTML & CSS for Beginners Part 16: CSS selectors and Specificity
HTML & CSS for Beginners Part 16: CSS selectors and Specificity
Kevin Powell
19 HTML & CSS for Beginners Part 17: How to Create and Style HTML Lists
HTML & CSS for Beginners Part 17: How to Create and Style HTML Lists
Kevin Powell
20 HTML & CSS for Beginners Part 18: How Floats and Clears work
HTML & CSS for Beginners Part 18: How Floats and Clears work
Kevin Powell
21 HTML & CSS for Beginners Part 19: Colors with CSS - hex, rgba, and hsla
HTML & CSS for Beginners Part 19: Colors with CSS - hex, rgba, and hsla
Kevin Powell
22 HTML & CSS for Beginners Part 20: How to center a div
HTML & CSS for Beginners Part 20: How to center a div
Kevin Powell
23 HTML & CSS for Beginners Part 21: How to create a basic website layout - the HTML
HTML & CSS for Beginners Part 21: How to create a basic website layout - the HTML
Kevin Powell
24 HTML & CSS for Beginners Part 22: How to create a basic layout - the CSS
HTML & CSS for Beginners Part 22: How to create a basic layout - the CSS
Kevin Powell
25 How to Create a Responsive Website from Scratch - Part 1: The HTML #Responsive #HTML5
How to Create a Responsive Website from Scratch - Part 1: The HTML #Responsive #HTML5
Kevin Powell
26 How to Create a Responsive Website from Scratch - Part 2: The Header and Hero area #Responsive #CSS3
How to Create a Responsive Website from Scratch - Part 2: The Header and Hero area #Responsive #CSS3
Kevin Powell
27 How to Create a Responsive Website from Scratch - Part 3: The About Section #Responsive #CSS
How to Create a Responsive Website from Scratch - Part 3: The About Section #Responsive #CSS
Kevin Powell
28 How to Create a Responsive Website from Scratch - Part 4: Building a Responsive Portfolio Section
How to Create a Responsive Website from Scratch - Part 4: Building a Responsive Portfolio Section
Kevin Powell
29 How to Create a Responsive Website from Scratch - Part 5: Call To Action and Footer #CSS #Responsive
How to Create a Responsive Website from Scratch - Part 5: Call To Action and Footer #CSS #Responsive
Kevin Powell
30 Tutorial: Learn how to use CSS Media Queries in less than 5 minutes
Tutorial: Learn how to use CSS Media Queries in less than 5 minutes
Kevin Powell
31 End of the year upate and what's coming to my channel to start the new year
End of the year upate and what's coming to my channel to start the new year
Kevin Powell
32 Create a CSS only Mega Dropdown Menu
Create a CSS only Mega Dropdown Menu
Kevin Powell
33 CSS Tutorial: Outline and Outline Offset
CSS Tutorial: Outline and Outline Offset
Kevin Powell
34 CSS Blending Modes
CSS Blending Modes
Kevin Powell
35 Parallax effect | 2 different ways to add it with jQuery
Parallax effect | 2 different ways to add it with jQuery
Kevin Powell
36 CSS Units: vh, vw, vmin, vmax #css #responsive #design
CSS Units: vh, vw, vmin, vmax #css #responsive #design
Kevin Powell
37 How to Create a Website - Complete workflow | Part 01: Intro + Setting things up
How to Create a Website - Complete workflow | Part 01: Intro + Setting things up
Kevin Powell
38 100 Subscribers speed coding bonus video
100 Subscribers speed coding bonus video
Kevin Powell
39 How to Create a Website - Complete workflow | Part 02: The Markup #HTML
How to Create a Website - Complete workflow | Part 02: The Markup #HTML
Kevin Powell
40 How to Create a Website - Complete workflow | Part 03: Sass Variables and a Mixin #Sass
How to Create a Website - Complete workflow | Part 03: Sass Variables and a Mixin #Sass
Kevin Powell
41 How to Create a Website - Complete workflow | Part 04: Setting up the hero and header
How to Create a Website - Complete workflow | Part 04: Setting up the hero and header
Kevin Powell
42 How to Create a Website - Complete workflow | Part 05: Typography & Buttons
How to Create a Website - Complete workflow | Part 05: Typography & Buttons
Kevin Powell
43 How to Create a Website - Complete workflow | Part 06.1: Building the navigation with Flexbox
How to Create a Website - Complete workflow | Part 06.1: Building the navigation with Flexbox
Kevin Powell
44 How to Create a Website - Complete workflow | Part 06.2: Making the nav work with jQuery
How to Create a Website - Complete workflow | Part 06.2: Making the nav work with jQuery
Kevin Powell
45 Redesigning & Coding My Website #CreateICG
Redesigning & Coding My Website #CreateICG
Kevin Powell
46 How to Create a Website - Complete workflow | Part 07: Starting the flexbox grid
How to Create a Website - Complete workflow | Part 07: Starting the flexbox grid
Kevin Powell
47 How to Create a Website - Complete workflow | Part 08: Promo & Problem shooting!
How to Create a Website - Complete workflow | Part 08: Promo & Problem shooting!
Kevin Powell
48 How to Create a Website - Complete workflow | Part 09: The CTA and Footer
How to Create a Website - Complete workflow | Part 09: The CTA and Footer
Kevin Powell
49 How to Create a Website - Complete workflow | Part 10: Making it responsive
How to Create a Website - Complete workflow | Part 10: Making it responsive
Kevin Powell
50 How to Create a Website - Complete workflow | Part 11: Making it responsive con't
How to Create a Website - Complete workflow | Part 11: Making it responsive con't
Kevin Powell
51 How to Create a Website - Complete workflow | Part 12: Putting the site online
How to Create a Website - Complete workflow | Part 12: Putting the site online
Kevin Powell
52 Create a Custom Grid System with CSS Calc() and Sass
Create a Custom Grid System with CSS Calc() and Sass
Kevin Powell
53 CSS em and rem explained #CSS #responsive
CSS em and rem explained #CSS #responsive
Kevin Powell
54 Should you use Bootstrap?
Should you use Bootstrap?
Kevin Powell
55 How to add Smooth Scrolling to your one page website with jQuery
How to add Smooth Scrolling to your one page website with jQuery
Kevin Powell
56 Let's learn Bootstrap 4
Let's learn Bootstrap 4
Kevin Powell
57 How I approach designing a website - my thought process
How I approach designing a website - my thought process
Kevin Powell
58 Build a website with Bootstrap 4 - Part 1: The setup
Build a website with Bootstrap 4 - Part 1: The setup
Kevin Powell
59 Build a website with Bootstrap 4 - Introduction
Build a website with Bootstrap 4 - Introduction
Kevin Powell
60 Build a website with Bootstrap 4 - Part 2:  Customizing Variables
Build a website with Bootstrap 4 - Part 2: Customizing Variables
Kevin Powell

This video teaches you how to create a customizable typewriter animation using CSS, covering topics such as custom properties, pseudo-elements, and keyframe animations. By following along, you'll learn how to create a realistic typewriter effect that can be customized to fit your needs. The animation is perfect for adding a touch of personality to your website or application.

Key Takeaways
  1. Create a short text with a mono space font
  2. Use before and after pseudo-elements for typewriter effect
  3. Set content property on pseudo-elements
  4. Give pseudo-elements different color backgrounds
  5. Adjust speed with one custom property
  6. Use position absolute to make elements relative to a parent
  7. Write keyframes to create an animation
  8. Use animation to create a typewriter effect
💡 The use of custom properties and pseudo-elements allows for a high degree of customizability in the typewriter animation, making it easy to adjust the speed, text, and style to fit your needs.

Related Reads

📰
Why Vanilla JS? In the article below, I am sharing my story of building SaaS product in vanilla js and explaining why I decided to go with this approach. https://guseyn.com/html/posts/why-vanilla-js.html
Learn why choosing Vanilla JS can be a great approach for building SaaS products and how it can simplify development
Dev.to · Guseyn Ismayylov
📰
How to Create a Cursor Tail Using HTML, CSS, and JavaScript
Learn to create a colorful cursor tail using HTML, CSS, and JavaScript for a unique user interface effect
Medium · JavaScript
📰
I built a landing page with Three.js, vanilla JS, and zero frameworks — here's what I learned
Learn how to build a landing page with Three.js and vanilla JS without relying on frameworks, and discover the key takeaways from this project
Dev.to · Ayush Shekhar
📰
Part 1: Why I Rarely Use useEffect Anymore (and what I use instead)
Learn why useEffect is not always the best choice in React and discover alternative solutions
Dev.to · Alejandro

Chapters (11)

Introduction
1:41 Use a monospace font
2:19 Setting the stage with pseudo-elements
3:55 Animation to reveal the text
5:45 Improving the animation with steps()
7:16 Using max-content for the width
9:18 Making the text look like it's being revealed
9:46 Adding the caret
11:48 The blinking animation
14:48 Making it easier to customize
16:01 Animating the other text
Up next
How To Build A Twitter Clone - React Next JS - Appwrite Crash Course
Adrian Twarog
Watch →