栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > Web开发 > Html/CSS > CSS教程

一款纯css3实现简单的checkbox复选框和radio单选框

CSS教程 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

  昨天为大家分享了一款很炫的checkbox复选框和radio单选框,今天再给大家带来一款简单实用的checkbox复选框和radio单选框。界面清淅、舒服。先给大家来张效果图:

  实现代码:

  html代码:

XML/HTML Code复制内容到剪贴板
  1.   
  2.           
  3.           
  4.               
  5.           
  6.           
  7.           
  8.               
  9.           
  10.           
  11.           
  12.               
  13.           
  14.           
  15.           
  16.               
  17.           
  18.           
  19.           
  20.               
  21.           
  22.     
  
  •       
  •           
  •           
  •               
  •           
  •           
  •           
  •               
  •           
  •           
  •           
  •               
  •           
  •           
  •           
  •               
  •           
  •           
  •           
  •               
  •           
  •     
  •   

      css3代码:

    CSS Code复制内容到剪贴板
    1. form   
    2.         {   
    3.             width: 100vw;   
    4.             height: 100vh;   
    5.             display: flex;   
    6.             flex-flow: column wrap;   
    7.             justify-content: center;   
    8.             align-items: center;   
    9.         }   
    10.         form .frame   
    11.         {   
    12.             display: flex;   
    13.             flex-flow: row nowrap;   
    14.         }   
    15.         form .frame input   
    16.         {   
    17.             display: none;   
    18.         }   
    19.         form .frame label   
    20.         {   
    21.             cursor: pointer;   
    22.             position: relative;   
    23.             width: 30px;   
    24.             height: 30px;   
    25.             margin: 10px;   
    26.             background: #8ABA56;   
    27.             transition: all 0.3s ease-in-out;   
    28.             font-size: 12pt;   
    29.             color: #FFF;   
    30.             -webkit-font-smoothing: antialiased;   
    31.         }   
    32.         form .frame label.radio   
    33.         {   
    34.             border-radius: 100%;   
    35.         }   
    36.         form .frame label.check   
    37.         {   
    38.             border-radius: 5px;   
    39.         }   
    40.         form .frame label .fa   
    41.         {   
    42.             position: absolute;   
    43.             top: 0;   
    44.             left: 0;   
    45.             rightright: 0;   
    46.             bottombottom: 0;   
    47.             opacity: 0;   
    48.             -webkit-transform: scale(0);   
    49.             transition: all 0.3s ease-in-out;   
    50.             line-height: 30px;   
    51.             text-align: center;   
    52.         }   
    53.         form .frame input:checked + label   
    54.         {   
    55.             background: #678b40;   
    56.         }   
    57.         form .frame input:checked + label .fa   
    58.         {   
    59.             opacity: 1;   
    60.             -webkit-transform: scale(1);   
    61.         }  

      好了。复制上面的html代码和css代码。轻松搞定一款漂亮的checkbox、radio按钮,谢谢阅读,希望能帮到大家,请继续关注考高分网,我们会努力分享更多优秀的文章。

    转载请注明:文章转载自 www.mshxw.com
    本文地址:https://www.mshxw.com/it/216561.html

    CSS教程相关栏目本月热门文章

    我们一直用心在做
    关于我们 文章归档 网站地图 联系我们

    版权所有 (c)2021-2022 MSHXW.COM

    ICP备案号:晋ICP备2021003244-6号