实例代码“Ctrl+/”提示“F11/ESC”全屏 返回 格式化 恢复 运行
x
 
1
<html><!DOCTYPE html>
2
<html>
3
<head>
4
<style> 
5
#div1
6
{
7
width:120px;
8
height:100px;
9
background-color:yellow;
10
border:1px solid black;
11
transform:rotate(7deg);
12
-ms-transform:rotate(7deg); /* IE 9 */
13
-webkit-transform:rotate(7deg); /* Safari and Chrome */
14
}
15
</style>
16
17
<script>
18
function rotate(value)
19
{
20
document.getElementById('div1').style.webkitTransform="rotate(" + value + "deg)";
21
document.getElementById('div1').style.msTransform="rotate(" + value + "deg)";
22
document.getElementById('div1').style.MozTransform="rotate(" + value + "deg)";
23
document.getElementById('div1').style.OTransform="rotate(" + value + "deg)";
24
document.getElementById('div1').style.transform="rotate(" + value + "deg)";
25
document.getElementById('span1').innerHTML=value + "deg";
26
}
27
</script>
28
29
</head>
30
<body>
31
32
<p>Rotate the yellow div element:</p>
33
34
<div id="div1">HELLO</div>
35
36
Rotate: <br>
37
<input type="range" min="-360" max="360" value="7" onchange="rotate(this.value)" /><br>
38
transform: rotate(<span id="span1">7deg</span>);
39
40
</body>
41
</html>