How to spin text on mouse hover using HTML and CSS? Last Updated : 31 Jul, 2024 Comments Improve Suggest changes Like Article Like Report The spinning of text on mouse hover is known as the Spin Effect or the Rotation Effect. In this effect, each alphabet of the word is rotated along with any one of the axes (preferably Y-axis). Each word is wrapped inside in <li> tag and then using CSS:hover Selector selector we will rotate each alphabet on Y-axis. We will divide this article into two sections, in the first section we will create the basic structure of the text that will spin. IN the second section we will make that text structure spinnable when the user the hover on that.Creating Structure: In this section we will create the structure by using HTML. HTML Code: In this we have created an unordered-list and wrap each alphabet inside an list-item(li). HTML <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Spin Text</title> <link rel="stylesheet" href="styles.css"> </head> <body> <ul> <li>G</li> <li>e</li> <li>e</li> <li>k</li> <li>s</li> <li>f</li> <li>o</li> <li>r</li> <li>G</li> <li>e</li> <li>e</li> <li>k</li> <li>s</li> </ul> </body> </html> Designing Structure: In this section we will make that structure spinnable and add the little bit of decoration. CSS Code: First we have provide some basic styling like margin, padding and background. Then we have aligned our list-items horizontally using the float property. Finally, use the hover selector to rotate each alphabet along Y-axis on a particular degree. If you want you can use n-th child property to apply some delay to rotation of each alphabet.The use of n-th child comes to personal preferences and needs so if you feel like using it you can surely go for it. CSS body { margin: 0; padding: 0; display: flex; justify-content: center; align-items: center; height: 100vh; background-color: #f0f0f0; font-family: 'Arial', sans-serif; } ul { display: flex; justify-content: center; align-items: center; padding: 0; margin: 0; } ul li { list-style: none; color: #228B22; /* Changed to a more attractive green color */ font-size: 60px; /* Increased font size */ font-weight: bold; margin: 0 5px; transition: transform 0.8s, color 0.8s; text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3); /* Added text shadow */ } ul:hover li { transform: rotateY(360deg); color: #FF4500; /* Color change on hover */ } Final Solution: It is the combination of the above two codes. HTML <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Spin Text</title> <style> body { margin: 0; padding: 0; display: flex; justify-content: center; align-items: center; height: 100vh; background-color: #f0f0f0; font-family: 'Arial', sans-serif; } ul { display: flex; justify-content: center; align-items: center; padding: 0; margin: 0; } ul li { list-style: none; color: #228B22; /* Changed to a more attractive green color */ font-size: 60px; /* Increased font size */ font-weight: bold; margin: 0 5px; transition: transform 0.8s, color 0.8s; text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3); /* Added text shadow */ } ul:hover li { transform: rotateY(360deg); color: #FF4500; /* Color change on hover */ } </style> </head> <body> <ul> <li>G</li> <li>e</li> <li>e</li> <li>k</li> <li>s</li> <li>f</li> <li>o</li> <li>r</li> <li>G</li> <li>e</li> <li>e</li> <li>k</li> <li>s</li> </ul> </body> </html> Output: Comment More infoAdvertise with us Next Article How to spin text on mouse hover using HTML and CSS? S sirohimukul1999 Follow Improve Article Tags : Web Technologies Web Templates Similar Reads How to Skew Text on Hover using HTML and CSS? Skewed text animation effect can be created using HTML and CSS, this animation looks very cool and can be used in websites to make them look more dynamic, the following sections will guide on how to create the desired animation effect.First Section: In this section we will create a basic div tag whi 2 min read How to Shake Text on hover using HTML and CSS? Shaking Text animation is a very cool animation which can be used in websites, this animation can be easily created using some basic HTML and CSS, the below section will guide on how to create the animation.HTML Code: In this section we have a basic div element which contains some text inside of it. 2 min read Shrink Text on Hover using HTML and CSS Text can be Shrinked or condensed using some HTML and CSS properties, you can use this animation in your websites as headings or sub-headings, the below sections will guide you on how to create the desired effect.HTML Code: In this section we have simple div element which contains the text separate 2 min read How to Rotate a Text 360 Degrees on hover using HTML and CSS? Rotating text 360 degrees on hover is a visual effect that makes text spin around its center point when the user hovers their cursor over it. To rotate text 360 degrees on hover using HTML and CSS, you can apply a CSS animation to the text element.Rotate A Text 360 Degrees On HoverThe text is center 2 min read How to Change Image Opacity on Hover using CSS ? Changing the opacity of an image on hover can add a more elegant and interactive effect to your website. This simple yet effective technique can be implemented using CSS. When a user hovers over an image, it gradually becomes more transparent, pointing out the interaction and creating an attractive 2 min read Like