美文网首页
Tailwind Filled Button

Tailwind Filled Button

作者: JunChow520 | 来源:发表于2020-05-30 13:24 被阅读0次
<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">
  • 内边距宽高比为 2:1
  • 填充色均采用中度为基准

小型填充按钮(small filled button)

  • 小型填充按钮内边距采用px-4 py-2
small filled button

源代码:https://codepen.io/junchow/pen/rNOXWPY?editors=1000

基础按钮

仅带文本的基础按钮

small filled button
<button class="px-4 py-2 mr-1 mb-1 bg-gray-500 outline-none rounded shadow text-white text-xs font-bold uppercase focus:outline-none hover:shadow-md active:bg-gray-600" type="button" style="transition:all .15s ease">button</button>
样式 属性
px-4 padding-left:1rem; padding-right:1rem;
py-2 padding-top:0.5rem; padding-bottom:0.5rem;
mr-1 margin-right:0.25rem;
mb-1 margin-bottom:0.25rem;
bg-gray-500 background-color:#a0aec0;
outline-none outline:0;
rounded border-radius:0.25rem;
shadow box-shadow:0 1px 3px 0 rgba(0, 0, 0, 1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
text-white color:#ffffff;
text-xs font-size:.75rem;
font-bold font-weight:700;
uppercase text-transform:uppercase;
focus:outline-none :focus{outline:0;}
hover:shadow-md :hover{shadow:none;}
active:bg-gray-600 :active{background-color:#718096;}

按钮图标

icon text button

由图标和文本组合的按钮

icon button
<button class="px-4 py-2 mr-1 mb-1 bg-blue-500 outline-none rounded shadow text-white text-xs font-bold uppercase focus:outline-none hover:shadow-md active:bg-blue-600" type="button" type="transition:all .15s ease">
  <i class="fa fa-plus"></i>
  add
</button>

仅带图标的按钮

icon text button
<button class="px-4 py-2 mr-1 mb-1 bg-blue-500 outline-none rounded shadow text-white text-xs font-bold uppercase focus:outline-none hover:shadow-md active:bg-blue-600" type="button" type="transition:all .15s ease">
  <i class="fa fa-plus"></i>
</button>

椭圆按钮

在小型填充按钮的基础上将rouned圆角修改为rounded-full即可。

round button
<button class="px-4 py-2 mr-1 mb-1 bg-blue-500 outline-none rounded-full shadow text-white text-xs font-bold uppercase focus:outline-none hover:shadow-md active:bg-blue-600" type="button" style="transition:all .15s ease">button</button>

<button class="px-4 py-2 mr-1 mb-1 bg-blue-500 outline-none rounded-full shadow text-white text-xs font-bold uppercase focus:outline-none hover:shadow-md active:bg-blue-600" type="button" style="transition:all .15s ease">
  <i class="fa fa-plus"></i>
  button
</button>

<button class="px-4 py-2 mr-1 mb-1 bg-blue-500 outline-none rounded-full shadow text-white text-xs font-bold uppercase focus:outline-none hover:shadow-md active:bg-blue-600" type="button" style="transition:all .15s ease">
  <i class="fa fa-plus"></i>
</button>

常规填充按钮(regular filled button)

  • 常规填充按钮内边距采用px-6 py-3
regular filled button
<button class="px-6 py-3 mr-1 mb-1 bg-gray-500 text-white text-sm font-bold uppercase rounded shadow outline-none focus:outline-none active:bg-gray-600 hover:shadow-lg" type="button" style="transition:all .15s ease">button</button>

常规填充按钮样式

regular filled button
<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 flex flex-col items-center justify-center">
  <div class="m-4 flex flex-row items-center justify-center">
    <button class="px-6 py-3 mr-1 mb-1 bg-gray-500 text-white text-sm font-bold uppercase rounded shadow outline-none focus:outline-none active:bg-gray-600 hover:shadow-lg" type="button" style="transition:all .15s ease">
      button
    </button>
    
    <button class="px-6 py-3 mr-1 mb-1 bg-blue-500 text-white text-sm font-bold uppercase rounded shadow outline-none focus:outline-none active:bg-blue-600 hover:shadow-lg" type="button" style="transition:all .15s ease">
      <i class="fa fa-plus"></i>
      button
    </button>
    
    <button class="px-6 py-3 mr-1 mb-1 bg-red-500 text-white text-sm font-bold uppercase rounded shadow outline-none focus:outline-none active:bg-red-600 hover:shadow-lg" type="button" style="transition:all .15s ease">
      <i class="fa fa-user"></i>
    </button>
  </div>
  <div class="m-4 flex flex-row items-center justify-center">
    <button class="px-6 py-3 mr-1 mb-1 bg-teal-500 text-white text-sm font-bold uppercase rounded-full shadow outline-none focus:outline-none active:bg-teal-600 hover:shadow-lg" type="button" style="transition:all .15s ease">
      button
    </button>
    
    <button class="px-6 py-3 mr-1 mb-1 bg-yellow-500 text-white text-sm font-bold uppercase rounded-full shadow outline-none focus:outline-none active:bg-yellow-600 hover:shadow-lg" type="button" style="transition:all .15s ease">
      <i class="fa fa-plus"></i>
      button
    </button>
    
    <button class="px-6 py-3 mr-1 mb-1 bg-green-500 text-white text-sm font-bold uppercase rounded-full shadow outline-none focus:outline-none active:bg-green-600 hover:shadow-lg" type="button" style="transition:all .15s ease">
      <i class="fa fa-user"></i>
    </button>
  </div>
</div>

大型填充按钮(large filled button)

  • 大型填充按钮内边距为px-8 py-3
  • 大型填充按钮字体使用text-base
  • 大型填充按钮阴影采用shadow-md
large filled button
<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 flex flex-col items-center justify-center">
  <div class="my-4 flex flex-row items-center justify-center">
    <button class="outline-none mr-1 mb-1 rounded px-8 py-3 bg-blue-500 text-base text-white font-bold uppercase shadow-md focus:outline-none active:bg-blue-600 hover:shadow-lg" style="transition:all .15s ease">
      button
    </button>
    
    <button class="outline-none mr-1 mb-1 rounded px-8 py-3 bg-blue-500 text-base text-white font-bold uppercase shadow-md focus:outline-none active:bg-blue-600 hover:shadow-lg" style="transition:all .15s ease">
      <i class="fa fa-pen"></i>
      button
    </button>
    
    <button class="outline-none mr-1 mb-1 rounded px-8 py-3 bg-blue-500 text-base text-white font-bold uppercase shadow-md focus:outline-none active:bg-blue-600 hover:shadow-lg" style="transition:all .15s ease">
      <i class="fa fa-pen"></i>
    </button>
  </div>
  <div class="my-4 flex flex-row items-center justify-center">
    <button class="outline-none px-8 py-3 rounded-full mr-1 mb-1 bg-blue-500 text-base text-white font-bold uppercase shadow-md focus:outline-none active:bg-blue-600 hover:shadow-lg" style="transition:all .15s ease">
      button
    </button>
    
    <button class="outline-none px-8 py-3 rounded-full mr-1 mb-1 bg-blue-500 text-base text-white font-bold uppercase shadown-md focus:outline-none active:bg-blue-600 hover:shadow-lg" style="transition:all .15s ease">
      <i class="fa fa-pen"></i>
      button
    </button>
    
    <button class="outline-none px-8 py-3 rounded-full mr-1 mb-1 bg-blue-500 text-base text-white font-bold uppercase shadow-md focus:outline-none active:bg-blue-600 hover:shadow-lg" style="transition:all .15s ease">
      <i class="fa fa-pen"></i>
    </button>
  </div>
</div>

相关文章

  • Tailwind Filled Button

    内边距宽高比为 2:1 填充色均采用中度为基准 小型填充按钮(small filled button) 小型填充按...

  • Tailwind Button

    按钮组 源代码查看地址 按钮组是由多个按钮水平排列而成,实现方式可分为两种,一种是依次设置左中右按钮的边框,一种是...

  • Tailwind Outline Button

    默认样式和字体图标资源 代码在线地址 轮廓按钮(outline button) 轮廓按钮背景为透明,选中后反色显示...

  • Tailwind Link Button

    链接按钮即将按钮转化为链接的表现形式 链接按钮基础形式 样式属性outline-noneoutline:0;mr-...

  • filled

    我们中有的人暗淡无光,有的色泽艳丽,有的则光彩照人,但是偶尔,你也会遇到色彩斑斓的人,当你遇到时,其他一切都不重要...

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

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

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

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

  • WHITE|be filled with deadlines

    之前看过小白我写文章的朋友,都知道小白我动不动就会思维枯竭,然后就会开始生产垃圾文学、 是的 今天小白在经历了一系...

  • 【第8天】【1013】幸福的一天

    The day that filled with happiness.

  • 8/25, Sat

    Filled gas, $52. Started at 48562!

网友评论

      本文标题:Tailwind Filled Button

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