I want to let my tekst rotate when you hover over it.
this is my css code:
html:
<p class="dot">R</p>
css:
.dot {
height: 100px;
width: 100px;
background-color: #ffeaa7;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
position: relative;
text-align: center;
margin: 2px;
filter: brightness(30%);
transition: 0.5s;
font-family:'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
font-size: 30px;
transform: rotate('0deg');
}
.dot:hover{
filter: brightness(100%);
font-size: 65px;
transform: rotate('45deg');
}
I tried to add the transform: rotate(’45deg’);
but that didn’t do it so i added at the orginal the same line of code but then with 0deg
4
Answers
Remove apostrophes.
To rotate text on hover, you can use the CSS transform property. In your current code, you are already using the transform property to rotate the text, but you need to change the value of the rotation angle to achieve the desired effect. Instead of using a fixed angle of 45 degrees, you can use the CSS transition property to smoothly animate the rotation of the text on hover. Here’s an example of how you can modify your code to achieve this effect:
NB : Don’t forget to remove the apostrophes for values in degrees
Do you mean like this?
I have updated css – Removed single quote from the transform property (transform: rotate(’45deg’);
FYI: if you want to rotate full you need to add 360deg instead of 45deg