css 汉堡菜单_使用CSS构建变形汉堡包菜单

css 汉堡菜单

Rencently I've found this awesome dribbble shot by Vitaly Rubtsov, and I could not resist the urge to try to implement it :)

最近,我发现了维塔利· 鲁布佐夫 (Vitaly Rubtsov) 拍摄的这张出色的运球 ,而我忍不住想要实现它的冲动:)

In this tutorial I'll explain the entire process of how to do it with CSS only, without using a single line of JavaScript. So, we will be seeing some CSS (and SCSS) tricks that will allow us to achieve an animation almost as smooth as the animated gif.

在本教程中,我将解释如何仅使用CSS而不用一行JavaScript的整个过程。 因此,我们将看到一些CSS(和SCSS)技巧,使我们能够实现几乎与动画gif一样平滑的动画。

Here's the CodePen of what we'll build:

这是我们将构建的CodePen:

标记 ( Markup )

Let's start with the HTML structure we'll be using. See the comments for better understanding.

让我们从我们将要使用HTML结构开始。 请参阅注释以获得更好的理解。

<div class="container">
    <!-- This checkbox will give us the toggle behavior, it will be hidden, but functional -->
    <input id="toggle" type="checkbox">

    <!-- IMPORTANT: Any element that we want to modify when the checkbox state changes go here, being "sibling" of the checkbox element -->

    <!-- This label is tied to the checkbox, and it will contain the toggle "buttons" -->
    <label class="toggle-container" for="toggle">
        <!-- If menu is open, it will be the "X" icon, otherwise just a clickable area behind the hamburger menu icon -->
        <span class="button button-toggle"></span>
    </label>

    <!-- The nav menu -->
    <nav class="nav">
        <a class="nav-item" href="">Dashboard</a>
        <a class="nav-item" href=""
  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值