[HTML/CSS] 简单的Menu图标
作者:互联网
<iframe frameborder="0" height="300" src="//jsrun.net/6kzKp/embedded/all/light" width="100%"></iframe>
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> <style> .Menu { width: 18px; height: 12px; position: relative; cursor: pointer; } .Menu:before, .Menu:after { content: ""; display: block; width: 18px; height: 2px; background: currentColor; border-radius: 8px; position: absolute; left: 0; transition: all ease-in 300ms; } .Menu:before { top: 0; box-shadow: 0 5px currentColor; } .Menu:after { bottom: 0; } .Menu:hover:before { top: 5px; box-shadow: none; -webkit-transform: rotate(225deg); transform: rotate(225deg); } .Menu:hover::after { bottom: 5px; -webkit-transform: rotate(135deg); transform: rotate(135deg); } </style> <div style="display: flex; justify-content: center; align-items: center; width: 100vw; height: 100vh;"> <div class="Menu"></div> </div> </body> </html>
标签:rotate,Menu,after,transform,HTML,5px,CSS,before 来源: https://www.cnblogs.com/SoYang/p/16257662.html