+11 votes
72 views
in Help by (26.3k points)
edited
How to rotate Image?

1 Answer

+22 votes
by (26.3k points)
 
Best answer

How to rotate image with javascript?

<img src="my-image.jpg" width="300" />

<!-- The image element to rotate -->

<img src="my-image.jpg" width="300" />

// Access DOM element object

const rotated = document.getElementById('rotated');

// Rotate element by 90 degrees clockwise

rotated.style.transform = 'rotate(90deg)';

how to rotate image with inspect element & how to change image with css

add rotate90 class to the DOM
and add this to the inspector:
.rotate90 {
    -webkit-transform: rotate(90deg);
    -moz-transform: rotate(90deg);
    -o-transform: rotate(90deg);
    -ms-transform: rotate(90deg);
    transform: rotate(90deg);
}
Ask a Question
Welcome to WikiTechSolutions where you can ask questions and receive answers from other members of the community.

You can ask a question without registration.

Categories

...