xxxxxxxxxx
// Access DOM element object
const rotated = document.getElementById('rotated');// Rotate element by 90 degrees clockwise
rotated.style.transform = 'rotate(90deg)';
xxxxxxxxxx
// Access DOM element object
const rotated = document.getElementById('rotated');// Rotate element by 90 degrees clockwise
rotated.style.transform = 'rotate(90deg)';
xxxxxxxxxx
//Code for image (HTML)
//<img id="img" src="https://via.placeholder.com/350x150.png" />
document.querySelector("#img").style.transform = "rotate(90deg)";
//Will rotate the image, finding it by the id 'img' and rotating it 90 degrees.
//You could also do this:
document.getElementById("img").style.transform = "rotate(90deg)";
//There is no significant difference: they are both well suited to the jobs they do,
//however querySelector is considered more felixble, as it can selec classes as well.
// (document.querySelector(".class"))