How to Rotate any HTML Object with CSS3

CSS3’s transform property is capable of applying a lot of cool effects to HTML objects. One of these cool effects is the rotating of HTML elements, which can really come in handy when trying to create unique designs or patterns with your CSS. With the transform property, any HTML object can be rotated. Let’s use the div below as an example, and say we want to rotate it by 20 degrees. Here’s how the code should look:

Screen Shot 2016-07-18 at 8.57.56 AM

Join us in our newest publication:
  1. div{
  2. transform: rotate(20deg);
  3. }

Here’s what the results look like:

Screen Shot 2016-07-18 at 8.57.42 AMYou can see that the square shape is now rotated on an angle. To rotate it more or less, you simply need to change the parameters that you pass through the rotate value.

You can also use the transform property to apply a 3D rotation to your HTML objects. By using rotateX, rotateY, or rotateZ instead of just ‘rotate’,  you can specify which axis you’d like to rotate your HTML element along. It’s also worth noting that the transform property isn’t universally supported by all browsers, so be sure to use the appropriate prefixes with this property to ensure cross-browser compatibility!

Share and Enjoy !

0Shares
0 0