美文网首页
Tailwind Toggle

Tailwind Toggle

作者: JunChow520 | 来源:发表于2020-06-08 02:49 被阅读0次
https://codepen.io/junchow/pen/VweLgOb?editors=1000

切换

toggle
<div class="relative inline-block w-10 mr-2 align-middle select-none transition duration-200 ease-in">
  <input type="checkbox" id="toggle" class="absolute block w-6 h-6 border-4 rounded-full bg-white cursor-pointer appearance-none toggle-checkbox">
  <label for="toggle" class="block h-6 rounded-full bg-gray-300 cursor-pointer overflow-hidden toggle-label"></label>
</div>

切换效果CSS实现

.toggle-checkbox:checked{
  @applay:right-0 border-green-400;
  right:0;
  border-color:#68D391;
}
.toggle-checkbox:checked + .toggle-label{
  @apply:bg-green-400;
  background-color:#68D391;
}

切换

toggle
<link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" rel="stylesheet">
<link href="https://cdn.bootcdn.net/ajax/libs/font-awesome/5.13.0/css/all.min.css" rel="stylesheet">

<div class="container mx-auto my-12 p-12 bg-gray-100">
  <div class="inline-flex rounded-full border-1 border-gray-300 bg-gray-200 shadow-md leading-none text-sm">
    <button class="inline-flex items-center px-4 py-2 bg-white rounded-full text-blue-400 transition-colors duration-300 ease-in focus:outline-none focus:text-blue-400 hover:text-blue-400">
      <i class="fa fa-th mr-2"></i>
      <span>表格</span>
    </button>
    <button class="inline-flex items-center px-4 py-2 rounded-r-full text-gray-500 transition-colors duration-300 ease-in focus:outline-none focus:text-blue-400 hover:text-blue-400">
      <i class="fa fa-list mr-2"></i>
      <span>列表</span>
    </button>
  </div>
</div>

相关文章

  • Tailwind Toggle

    切换 切换效果CSS实现 切换

  • Fe-12 dom&轮播图

    Fe-12-1 Fe-12-2 toggle Toggle 效果:toggle.gif toggle.html t...

  • Toggle和ToggleGroup

    Toggle Toggle继承了Selectable,实现了 IPointerClickHandler, ISub...

  • 使用React和Tailwind CSS搭建项目框架

    众所周知,Tailwind CSS框架越来越流行,所以我决定尝试学习并使用Tailwind CSS来搭建一个项目模...

  • 使用SASS模仿TailwindCSS生成常用CSS样式

    最近维护MPX小程序项目发现没有基础样式库,由于MPX版本比较老不兼容tailwind库,用惯了tailwind后...

  • jquery api

    toggle.toggle(duration,easing, function)duration:持续时间easi...

  • 2018-07-25-回调中遇到的一些方法

    toggle切换true/false user.toggle(:terms_of_service)PS: 1、如果...

  • Toggle

    重新回归简书,目前仍在使用的 博客: http://skyrover.me Github: https://git...

  • Toggle

    一、三个Toggle,三选一 二、给Toggle注册事件,选择哪个执行哪个里面的方法1、分别写三个带bool类型参...

  • toggle

    动词:切换名词:开关大致的意思是按一下一个状态,再按一下到另外一个状态。

网友评论

      本文标题:Tailwind Toggle

      本文链接:https://www.haomeiwen.com/subject/ifpktktx.html