transform-rotate旋轉
阿新 • • 發佈:2020-08-13
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title></title> <style> .box{ width: 300px; height: 300px; background-color: red; margin:100px auto; transition:all 1s; color:#fff; font-size:50px; } /* rotate(角度) 旋轉 正值 順時針 賦值:逆時針 */ .box:hover{ transform:rotate(-945deg); } .out{ width: 300px; height: 150px; background-color: pink; margin-top:200px; position: relative; } .out::before{ content:""; position: absolute; width: 50px; height: 50px; background-color: pink; transform:rotate(45deg); left:40%; top:-15px; }</style> </head> <body> <div class="box">1</div> <div class="out"> </div> </body> </html>