YonL YonL - 6 months ago 65
HTML Question

Invalid property value CSS rotate

I created a class and I am trying to rotate 45 degrees in CSS, but Chrome says "Invalid property value"



.cr {
background-color: #444;
position: absolute;
left: 5px;
top: 13.5px;
width: 20px;
height: 3px;
-o-webkit-transform: rotate(45deg);
-o-moz-transform: rotate(45deg);
-o-ms-transform: rotate(45);
transform: rotate(45deg);
}

<div class="cr"></div>





Why is this happening??

Answer

You don't need the o-webkit.
o stands for Opera, webkit is the engine behind Chrome.

It's simply -webkit-transform: rotate(45deg);

Same with the moz prefix.