CSS animation on input focus: add an animated outline with CSS and JavaScript

Published: 25 October 2021
on channel: pmCodingTutorials
2,751
55

In this CSS animation tutorial, I explain how to use the CSS background-image property to add an outline to your input fields. With the help of JavaScript we can then trigger the CSS animation every time one of the input fields gets focused on.

Blog post for written step by step explanation: https://www.pmcoding.co.uk/posts/inpu...

Source code:
https://github.com/patriciamolnar/tut...
Poppins Font:
https://fonts.google.com/specimen/Pop...
Tailwind CSS sr-only class information:
https://tailwindcss.com/docs/screen-r...

Watch other CSS animations and transitions tutorials that I created:
SVG animation: animate an SVG with CSS and JavaScript:
   • SVG animation: animate an SVG icon wi...  

CSS text animation with variable fonts:
   • CSS Text Animation with Variable Font...  

Add underline animation to your website with JavaScript Intersection Observer API:
   • Animated Underline using Intersection...  

I put out web development and design tutorials every 1 - 2 weeks, so subscribe for more:
   / channel  

I am also on social media, so feel free to connect and reach out:
Twitter:   / pmcoding  
Instagram:   / pmcoding  
CodePen: https://codepen.io/patriciamolnar


Watch video CSS animation on input focus: add an animated outline with CSS and JavaScript online without registration, duration hours minute second in high quality. This video was added by user pmCodingTutorials 25 October 2021, don't forget to share it with your friends and acquaintances, it has been viewed on our site 2,751 once and liked it 55 people.