Sobes.tech
Junior

How would you rotate an element by 45 degrees?

sobes.tech AI

Answer from AI

/* Rotate an element 45 degrees around its center */
transform: rotate(45deg);

Depending on the context, you can use JavaScript:

// Get the element
const element = document.getElementById('myElement');

// Rotate the element 45 degrees
element.style.transform = 'rotate(45deg)';

To rotate around a different point, you can use the transform-origin property in CSS:

/* Rotate an element 45 degrees around the top left corner */
transform-origin: top left;
transform: rotate(45deg);