如何让div旋转一定的角度

本文展示了如何使用HTML、CSS和JavaScript实现DIV元素的旋转效果,包括使用不同的浏览器前缀来确保兼容性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

m11,m12,m21.m22是控制角度的

<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>DIV旋转属性的演示</title>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
<style type="text/css">
body {
font-family: "Arial", sans-serif;
}
#example {
position: absolute;
border: #09F solid 1px;
font-weight: 900;
padding: 10px;
display: block;
width: 500px;
height: 400px;
margin-top: -1px;
margin-left: -1px;
transform: rotate(40deg);
-o-transform: rotate(40deg);
-webkit-transform: rotate(40deg);
-moz-transform: rotate(40deg);
filter: progid:DXImageTransform.Microsoft.Matrix(sizingMethod='auto expand', M11=1.2660444431189777, M12=-0.3327876096865394, M21=0.1127876096865398, M22=0.9660444431189779);
}
</style>
<!--[if IE]>
<style type="text/css">
#example {
top: 50px;
left: 50px;
}
</style>
<![endif]-->
</head>
<body>
<div id="example"> 旋转成功</div>
</body>
</html>

转载于:https://www.cnblogs.com/1003487863qq/archive/2013/01/05/2846232.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值