Customizable typewriter animation with CSS

SdĂ­let
VloĆŸit
  • čas pƙidĂĄn 5. 08. 2024
  • After seeing a tweet from Prantham on Twitter (make sure to give him a follow: / 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: codepen.io/kevinpowell/pen/Ex...
    ✅ If you're new to custom properties, watch this: ‱ CSS Custom Properties
    ✅ All about ::before and ::after : ‱ Before and After - CSS...
    ✅ min(), max(), and clamp(): ‱ min(), max(), and clam...
    ✅ Fun Glowing Neon Button effect: ‱ Create a neon button w...
    ✅ Other fun CSS effects: ‱ Fun CSS effects
    ✅ Follow Jhey on Twitter for incredible CSS stuff: / 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
    💬 / discord
    Keep up to date with everything I'm up to
    ✉ www.kevinpowell.co/newsletter
    Come hang out with me live every Monday on Twitch!
    đŸ“ș / kevinpowellcss
    ---
    Help support my channel
    👹‍🎓 Get a course: www.kevinpowell.co/courses
    👕 Buy a shirt: teespring.com/stores/making-t...
    💖 Support me on Patreon: / kevinpowell
    ---
    My editor: VS Code - code.visualstudio.com/
    ---
    I'm on some other places on the internet too!
    If you'd like a behind the scenes and previews of what's coming up on my CZcams channel, make sure to follow me on Instagram and Twitter.
    Twitter: / kevinjpowell
    Codepen: codepen.io/kevinpowell/
    Github: github.com/kevin-powell
    ---
    And whatever you do, don't forget to keep on making your corner of the internet just a little bit more awesome!

Komentáƙe • 354

  • @primalscream40
    @primalscream40 Pƙed 3 lety +362

    I’m totally new to html/ css. The stuff that you create with css just totally makes me keep pushing myself to learn more. Your an inspiration to me. Keep up the awesome work.

    • @KevinPowell
      @KevinPowell  Pƙed 3 lety +38

      Thanks so much, and keep at it!

    • @kaustubha7371
      @kaustubha7371 Pƙed 3 lety +6

      I am down on the same path and its true it helps me keep pushing myself to learn more.

    • @daleryanaldover6545
      @daleryanaldover6545 Pƙed 3 lety +5

      keep it up guys, the same reason why I started learning css 7 years ago

    • @primalscream40
      @primalscream40 Pƙed 3 lety +3

      @@daleryanaldover6545 I’ve got a question. When I’m in html/css and have live server open. How can I make my browser scale to adjust without having to release the window to see the changes take effect. Make sense.

    • @daleryanaldover6545
      @daleryanaldover6545 Pƙed 3 lety +6

      @@primalscream40 if you mean the same as in Kevin's videos where he saves the file and browser automatically updates the saved changes. Then, try searching for the term "Hot reloading or Live reloading". You need to install some dependency depending on what framework you are working on. If you are using VS Code, you can install Live Server extension as it features live reloading out of the box.

  • @captainray7465
    @captainray7465 Pƙed 3 lety +34

    That steps function is really cool.

  • @calin-andreipantis-simut6241

    Man, your videos are so inspiring, I am following you since the beginning where I didn't know what CSS even is. Now I am a developer and still find your videos to be so amazing. Keep going, you're doing a great job. I really appreciate your work! Congratulations!

  • @Reloko369
    @Reloko369 Pƙed 3 lety +1

    Thanks, men. What you do is gold to me. I'm 36 years old and learning from 0 HTML, CSS, and JS. You make me realize the power of CSS in all this. I love the passion you put into it. Also, I have to say, your English is crystalline for me (Argentinian). I reconnect to learn this language with your videos.

  • @alicianunez7801
    @alicianunez7801 Pƙed 3 lety +1

    Thank you so much for this! I had trouble with my cursor going past my text but the display: grid and the width: max-content completely fixed it! You're the only person on the internet that was able to solve it!

  • @MrSupdup
    @MrSupdup Pƙed 3 lety +34

    I just wanted to say that after watching your Neon video I instantly subscribed, and now seeing this video I'm a permanent fan. You're showing me really cool CSS tricks that I can actually imagine using in my projects (this one I'll actually be using in my next project, so thank-you for that!), in a way that is extremely digestible. The way you work through your logic out loud is exactly how my brain thinks, you have an excellent educational style and I'm really appreciative of the content and the effort!

  • @soumyajitdey5720
    @soumyajitdey5720 Pƙed 3 lety +2

    I love Kevin so much. A CSS guru! I used to hate CSS so much because I didn't understand it properly and now after knowing the basics what he is doing in each line absolutely makes sense. I will surely integrate this in one of my projects.

  • @emmanuelibuaka4118
    @emmanuelibuaka4118 Pƙed 3 lety

    The first sign of a good tutor is that he's not afraid to refer you to persons or resources that he knows can help in your learning journey. Much ❀ Kevin

  • @UniqueBots
    @UniqueBots Pƙed 3 lety +2

    Dude this is PURE GENUISNESS! Loved the tricks.

  • @AbdicateDotNet
    @AbdicateDotNet Pƙed 3 lety +2

    Wow!! I've been "playing" in HTML/CSS since their inception (revealing my age) and I am so happy for CSS 3! What a difference! Thank you for teaching an old dog new tricks! I am going to WOW folks now! đŸ‘đŸ™Œâ€đŸ˜ŠđŸ˜·

  • @MrMeszaros
    @MrMeszaros Pƙed 2 lety +69

    Hey, to get a better bink cursor:
    change to steps(2, start) - with infinite, this will cycle through the two end-states
    use visibility: hidden instead of background: transparent - this will ensure no transparency blending occurs.

  • @Ana-hc1cf
    @Ana-hc1cf Pƙed 3 lety

    Ugh, I needed this so badly two weeks ago, I just wanted to add this animation to my website and didn't find any good tutorials, I am happy now

  • @Morrile1
    @Morrile1 Pƙed 3 lety

    I love tips like this, straightforward and simple.

  • @CloudBroadcasts
    @CloudBroadcasts Pƙed 3 lety +3

    Thanks for the content - I’ve learned a lot from you. Keep ‘em coming!

  • @xrgiok
    @xrgiok Pƙed 2 lety

    I'm 33 year old and just start to learn html/css , and you inspire me! Thanks Kevin, you're really really good teacher!

  • @__matthi
    @__matthi Pƙed 3 lety +1

    You're brilliant at explaining things. Thank you so much!

  • @johndoggett4657
    @johndoggett4657 Pƙed 3 lety +4

    Dood Kevin you are a mind reader. I wanted to learn this effect for work and my portfolio.

  • @cwang9945
    @cwang9945 Pƙed 3 lety +1

    So amazing. Thank you sir. I really love this typing effect.

  • @ibrahimkedir2280
    @ibrahimkedir2280 Pƙed 2 lety

    You are the best mate, cheers really; sometimes I just hit the like buttons of your videos with out even watching them.

  • @deathstarhz3426
    @deathstarhz3426 Pƙed 3 lety +46

    Pro Tip: If you want to find out how many characters are in any given amount of text, highlight it in vs code, and look at the bottom bar, it should say "Ln ##, Col ## ( [number-of-characters] selected)

    • @b3nj4m1nyt
      @b3nj4m1nyt Pƙed rokem

      I already knew it but somehow I forgot it, so I actually opened notepad because I remembered that it has the same feature 😆

  • @Gloom-Grave
    @Gloom-Grave Pƙed 3 lety +49

    The icing on the cake would be if you can make cursor movements from one position to the next fluid. That's what I really enjoy about MS Office :)

    • @mariocamspam72
      @mariocamspam72 Pƙed 2 lety +2

      exactly! thats called a smooth caret

    • @dawatcherz
      @dawatcherz Pƙed 2 lety

      for the speed of the cursor you could use calc( var(--typewriterspeed) / var(--typewriterCharacters)) , i think

    • @RondellKB
      @RondellKB Pƙed 2 lety +3

      This is actually easy, a little cumbersome but very straightforward. Instead of using the step function, you can manually enter fixed points in the animation, and for each one, add to the left position, the width of one character.
      Example. Say your word has 10 characters in it, instead of doing step(10), you can add animation points: 10%, 20%, 30%, and so on up to 100%. Since the font is monospaced, each character will have the same width, find the width of one character, and in each animation point, add the width of the character to the current value of left. the result is a smooth transition from one character to the next.

    • @fruitygranulizer540
      @fruitygranulizer540 Pƙed 2 lety +1

      ive always found that super annoying, the cursor feels like its lagging behind when you type quickly ( i type 120 - 140 wpm )

  • @shaheerkhan_khawjikzai
    @shaheerkhan_khawjikzai Pƙed rokem

    I try this on my portfolio ,great work Kevin

  • @advanceringnewholder
    @advanceringnewholder Pƙed 3 lety

    this is probably the channel i need to finish my project

  • @ChrisPirillo147
    @ChrisPirillo147 Pƙed 3 lety

    I was thinking about this a few days ago, and it finally popped up :)

  • @yutaishere
    @yutaishere Pƙed 3 lety

    This is very helpful! Thanks so much Kevin!

  • @softvibes1602
    @softvibes1602 Pƙed 3 lety

    dude, you are a pro in CSS, I'm subbing to you right now!

  • @soyaiburrahman3806
    @soyaiburrahman3806 Pƙed 3 lety

    only one of your videos solves many of my problems.thanks boss

  • @yauhenisafronau9302
    @yauhenisafronau9302 Pƙed 2 lety

    Great work. Learning from the greatest masters.

  • @unnervingibet117
    @unnervingibet117 Pƙed 2 lety +5

    I’m learning python but watching this on CSS was such a blast, I think I’m just obsessed with code, it’s so fun to watch and learn and to make matters better, you’re very entertaining

    • @charusharma7872
      @charusharma7872 Pƙed rokem

      animated Box With CSS
      czcams.com/video/gBmx3RmThDE/video.html

  • @theshowwatcher3414
    @theshowwatcher3414 Pƙed 3 lety

    In your every video I learn something new.

  • @skalexshanghai
    @skalexshanghai Pƙed rokem

    Awesome!!! Thanks for the class!!

  • @teal4069
    @teal4069 Pƙed 3 lety

    Amazing tutorial... not only the content but also your explanations are so on point

    • @charusharma7872
      @charusharma7872 Pƙed rokem

      animated Box With CSS
      czcams.com/video/gBmx3RmThDE/video.html

  • @zneverending3585
    @zneverending3585 Pƙed 3 lety +6

    You are the reason of why i still can't start learning JS after Html and Css

  • @SothearithKONGMrMuyKhmer
    @SothearithKONGMrMuyKhmer Pƙed 3 lety

    Thanks Kevin; that’s awesome! 👍😍

  • @baharhussain6308
    @baharhussain6308 Pƙed 2 lety

    very amazing idea i am so excited from this.

  • @MrStefanica
    @MrStefanica Pƙed 3 lety

    Very nice ! Thank you Kevin !

  • @Baljeettest
    @Baljeettest Pƙed 3 lety

    Super idea, hats off Kevin..... ✌

  • @binitdemta3793
    @binitdemta3793 Pƙed 3 lety

    Really great. Thanks for the wonderful videos.

  • @mimoduocss
    @mimoduocss Pƙed 3 lety +40

    Dang clever trick and nice explanation! Clip-path would help remove the dependency on the background color ;)

    • @xXYourShadowDaniXx
      @xXYourShadowDaniXx Pƙed 3 lety +5

      Good episode, I made the clip path version here: codepen.io/Event_Horizon/pen/RwpQNyB?editors=1100

    • @_AverageGuy
      @_AverageGuy Pƙed 2 lety

      I know it's late but can you explain how to use clip path cuz I have an image as background

  • @raigallino
    @raigallino Pƙed 2 lety

    I hated css and you make me love it. Thank you kevin!

  • @habibthekhan
    @habibthekhan Pƙed 3 lety

    wow this was cool I didn't know about this steps animation thank you soo much

  • @gamersdestiny403
    @gamersdestiny403 Pƙed 3 lety

    😼 I thought it was a old video. This video is just right on time 😯😯😯😯

  • @jpzro3158
    @jpzro3158 Pƙed 3 lety

    This is pretty cool!

  • @AshishKumar-rq8gb
    @AshishKumar-rq8gb Pƙed 3 lety +2

    Man. Thankyou so much. I have been working as a front end dev for 1 year and I was so afraid of using animations. Rather I should say, I never tried them. And you taught them through this so easily. Thanks a ton. I am going to follow all your tuts now and see how well I can do. :-)

    • @charusharma7872
      @charusharma7872 Pƙed rokem

      animated Box With CSS
      czcams.com/video/gBmx3RmThDE/video.html

  • @devc_
    @devc_ Pƙed 3 lety

    Great explanation, love your videos

  • @zachjensz
    @zachjensz Pƙed 3 lety +3

    OMG I didn't notice the headphones until you said

  • @GeorgeNorberg
    @GeorgeNorberg Pƙed 2 lety

    Love your videos!

  • @JaskSkull1991
    @JaskSkull1991 Pƙed 2 lety

    Bro! Thank you! I am building my website to showcase my blockchain and cybersecurity projects and was looking to add a typewriter effect and nothing worked, but yours solution did! Thank you!

  • @danielcir8675
    @danielcir8675 Pƙed 3 lety

    Thank you, Dr. CSS

  • @ankurc
    @ankurc Pƙed 3 lety

    Very fun might have to try in my portfolio page

  • @dave6012
    @dave6012 Pƙed 3 lety

    Steps! i had no idea. Thank you.

  • @sanmeetsingh4
    @sanmeetsingh4 Pƙed 3 lety +1

    Another super cool video 😎

  • @AdityaDhungana
    @AdityaDhungana Pƙed 3 lety

    You're great Kevin.

  • @bunnydevx
    @bunnydevx Pƙed 3 lety +1

    awesome vid keep it up man i also use typing animation on my website and it looks nice

  • @CarlosHernandez-tg3vj
    @CarlosHernandez-tg3vj Pƙed 3 lety

    Alright alright, I'll subscribe that's pretty cool

  • @sanjibchanda21
    @sanjibchanda21 Pƙed 3 lety

    What a tricky animation 😅 awesome 👌

  • @codehal
    @codehal Pƙed rokem +1

    Amazing tutorial sir!

  • @Tiger1AuasfE
    @Tiger1AuasfE Pƙed 2 lety

    Nice, thnx for uploading.

  • @rezarahman1782
    @rezarahman1782 Pƙed 3 lety

    CSS animation is really really strong.đŸ„°

  • @aaeonCodes
    @aaeonCodes Pƙed 2 lety

    Thank you very much for such a great content

  • @angelocina5914
    @angelocina5914 Pƙed 3 lety

    Thka mate!! you are a master!!!

  • @vin-kry
    @vin-kry Pƙed 3 lety +1

    Thanks a lot KP for this Tutorial!!!
    Actually, As a React developer I was using tract Typical for such typewriter effects.
    But wanted to create it with Css but unable to create.
    Now I can create easily...
    Thanks a lot!!!!

    • @charusharma7872
      @charusharma7872 Pƙed rokem

      animated Box With CSS
      czcams.com/video/gBmx3RmThDE/video.html

  • @howabadworld
    @howabadworld Pƙed 3 lety

    Nice video, Good Job!

  • @mdazizulislam2498
    @mdazizulislam2498 Pƙed 3 lety

    wow nice explanation. thank you so much

  • @whoman0385
    @whoman0385 Pƙed 2 lety

    Thanks so much i can finally make my own website!

  • @lyckagennie6039
    @lyckagennie6039 Pƙed 3 lety

    Yay! New Learning Thanks Mr.
    From a Grade 12 student😊

  • @BenRogersWPG
    @BenRogersWPG Pƙed 3 lety

    Very cool

  • @0x007A
    @0x007A Pƙed 2 lety

    This technique might add a subtle bit of bling to my portfolio website that I am developing.

  • @himalmevada7989
    @himalmevada7989 Pƙed 3 lety

    I Just dive in animation and it's really Fun. the video is awesome nicely explained

  • @susityy2030
    @susityy2030 Pƙed 2 lety

    Thank you!

  • @navidmafi
    @navidmafi Pƙed 3 lety

    Thank you, very useful

  • @brunomocellin
    @brunomocellin Pƙed 2 lety

    I'm just entering the world of programing but i already understand the logic behind it. Your video is so cool as you add steps to it. I'm willing to make an Alert (StreamElements) with that effect, just need to think how the variables of text, text size and names will fit.

  • @alirajabli
    @alirajabli Pƙed 3 lety

    Excellent , Thank you man!

    • @charusharma7872
      @charusharma7872 Pƙed rokem

      animated Box With CSS
      czcams.com/video/gBmx3RmThDE/video.html

  • @ktytar
    @ktytar Pƙed 3 lety

    Thanks, you rock !

  • @TungNguyen-dr3ue
    @TungNguyen-dr3ue Pƙed 3 lety +1

    Great content. You're my inspiration for learning more and more.
    Thank you very much!!!
    Hope you have a beautiful day.
    P/s: I think it will look really amazed if there is an intro for your video

  • @jenniferward6821
    @jenniferward6821 Pƙed 3 lety

    Clever boy!!!

  • @Victor_Marius
    @Victor_Marius Pƙed 3 lety +4

    Yet again I learned something new from you. Didn't knew about steps() for animation

    • @charusharma7872
      @charusharma7872 Pƙed rokem

      animated Box With CSS
      czcams.com/video/gBmx3RmThDE/video.html

  • @sametkuIa
    @sametkuIa Pƙed 3 lety

    nice work thanks

  • @ziaahmad8738
    @ziaahmad8738 Pƙed 3 lety

    Wao this is incredible

  • @anjor3206
    @anjor3206 Pƙed 3 lety

    CSS guru 🙌

  • @codedynamics1
    @codedynamics1 Pƙed 2 lety

    really cool thanks, however when you are developing for smaller sized screens and the h1 content takes up 2 lines the "caret" reveals both words at the same time so it looks like its typing out 2 words which are on different lines at once ? How do you fix this

  • @plejra
    @plejra Pƙed rokem

    Wow I thought i will be simple. 20 minutes for so simple effect

  • @youtub4444
    @youtub4444 Pƙed 3 lety

    Nice Anim!

  • @Dexter101x
    @Dexter101x Pƙed 3 lety

    Hilariously ingenious

  • @sanjaysushiv13
    @sanjaysushiv13 Pƙed 3 lety

    Awesome

  • @manoranjanpanigrahi3677
    @manoranjanpanigrahi3677 Pƙed 2 lety

    I am having background image so what should i put as background in the h1::before to get the typing effect?

  • @marketinginhouse
    @marketinginhouse Pƙed 2 lety

    What good videos, greetings from Peru

  • @i_am_pasindu
    @i_am_pasindu Pƙed 3 lety

    For a moment I checked the video playback speed. it felt like I was watching at 1.25 or 1.5 🙄 BTW nice tutorial

  • @fazlerobi
    @fazlerobi Pƙed 3 lety

    Thanks for the video.

  • @Adjust91
    @Adjust91 Pƙed 2 lety

    for some reason I'm still getting issues animation, im still getting that choppy reveal even after following all the steps.. could it be because of the font im using?

  • @CK-qh5te
    @CK-qh5te Pƙed 3 lety

    Perfect, tutorial. Thank you!

    • @charusharma7872
      @charusharma7872 Pƙed rokem

      animated Box With CSS
      czcams.com/video/gBmx3RmThDE/video.html

  • @gopalloharnew5948
    @gopalloharnew5948 Pƙed 2 lety +1

    The video is awesome

  • @evanjoyal9540
    @evanjoyal9540 Pƙed 3 lety

    ok but, is there any reason to use css over a traditional animation? I feel like the load time would be pretty much exactly the same.

  • @commentmyideas4523
    @commentmyideas4523 Pƙed 3 lety +1

    Hair cut done 😂😂 styling looks good css

  • @dylanabdou1975
    @dylanabdou1975 Pƙed 2 lety

    Super !!!

  • @jeka2233
    @jeka2233 Pƙed 2 lety

    awesome

  • @witheredgroup
    @witheredgroup Pƙed 3 lety +2

    Is there any way to do it *without* a monospace font?

  • @bobrobertsNotUrBob
    @bobrobertsNotUrBob Pƙed 3 lety

    Very smart, if I knew about "steps" then I guess I could have figured it out...the more you know

  • @ABelfakirVlogs
    @ABelfakirVlogs Pƙed 3 lety

    what if the background is transparent? because I have a 3d animation video as my website background??? pls help

  • @registeredfunnyguy
    @registeredfunnyguy Pƙed 3 lety

    What if you wanted to make that cursor line instantly go transparent, instead of fading to transparent?