css3 transform

效果

<!doctype html>

<html>

????<head>

????????<title>標(biāo)題</title>

????????<meta charset="utf-8">

????????<style>

????????????#d1{

????????????????width:100px;

????????????????height:100px;

????????????????border:2px solid red;

????????????????background:yellow;

????????????????font-size:28px;

????????????????font-weight:bold;

????????????????text-align:center;

????????????????line-height:100px;

????????????????border-radius:50%;

????????????????/* 指定屬性 對性能會有優(yōu)化 哪些屬性才有動效 其他的就不用檢測了 */

????????????????transition-property:transform background width height line-height font-size;

????????????????/*2、時長*/

????????????????transition-duration:5s;

????????????????/*3、速度*/

????????????????transition-timing-function:linear;

????????????}

????????????#d1:hover{

? ? ? ? ? ? /* 指定旋轉(zhuǎn)圓心 */

? ? ? ? ? ? ? ? transform-origin:center center;/* left top /10px 10px ..*/

? ? ? ? ? ? /* 要先指定方向再指定角度不然會亂 */

????????????????transform:translateX(300px) rotate(1080deg);

? ? ? ? ? ? ? ? background:red;

? ? ? ? ? ? ? ? width:200px;

? ? ? ? ? ? ? ? height:200px;

? ? ? ? ? ? ? ? line-height:200px;

? ? ? ? ? ? ? ? font-size:60px;

????????????}

????????</style>

????</head>

????<body>

????????<div id="d1">

????????????滾

????????</div>

????</body>

</html>

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容