div+css实现伸缩菜单导航条效果代码
代码语言:html
所属分类:菜单导航
代码描述:div+css实现伸缩菜单导航条效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/all.5.15.3.css"> </head> <style> * { margin: 0; padding: 0; box-sizing: border-box; } body { display: flex; justify-content: center; align-items: center; min-height: 100vh; background: #6843cf; font-family: consolas; } .container { position: relative; } .container .navigation { position: relative; width: 240px; height: 360px; background: #fff; border-radius: 10px; overflow: hidden; transition: 0.5s; } .container .navigation.active { width: 80px; } .container .navigation ul { position: absolute; top: 0; left: 0; width: 100%; } .container .navigation ul li { position: relative; list-style: none; width: 100%; } .container .navigation ul li:hover { background: #efefef; } .container .navigation ul li a { position: relative; display: block; width: 100%; display: flex; text-decoration: none; color: #6843cf; font-weight: 600; } .container .navigation ul li a .icon { position: relative; display: block; min-width: 80px; height: 60px; line-height: 70px; text-align: center; } .container .navigation ul li a .icon i { font-size: 24px; } .container .navigation ul li a .title { position: relative; display: block; opacity: 1; height: 60px; line-height: 60px; white-space: nowrap; transition: .5s; } .container .navigation.active ul li a .title { opacity: 0; } .toggle { position: absolute; right: -20px; top: calc(50% - 20px); width: 40px; height: 40px; background: #f5f5f5; cursor: pointer; border: 5px solid #6843cf; border-radius: 50%; } .toggle i { position: absolute; width: 100%; height: 100%; line-height: 30px; text-align: center; font-size: 16px; color: #6843cf; transform: rotate(180deg); transition: .4s; } .toggle.active i { transform: rotate(0deg); } </style> <body> <div class="container"> <div class="na.........完整代码请登录后点击上方下载按钮下载查看
网友评论0