zoukankan      html  css  js  c++  java
  • CSS3-按钮

     按钮颜色

            .button1 {background-color: #4CAF50;} /* Green */

      按钮大小

             .button1 {font-size: 10px;}

      圆角按钮

             .button1 {border-radius: 2px;}

      按钮阴影

             box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2);

      禁用按钮

             .disabled {
        opacity: 0.6;
        cursor: not-allowed;

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="utf-8"> 
    <title>按钮</title> 
    <style>
    .button {
      display: inline-block;
      /*边框*/
      border-radius: 4px;
      /*背景*/
      background-color: #f4511e;
      border: none;
      color: #FFFFFF;
      text-align: center;
      /*大小*/
      font-size: 28px;
      padding: 20px;
      width: 200px;
      transition: all 0.5s;
      cursor: pointer;
      margin: 5px;
      /*阴影*/
      box-shadow: 0 12px 16px 0 rgba(0,0,0,0.24), 0 17px 50px 0 rgba(0,0,0,0.19);
    }
    
    .button span {
      cursor: pointer;
      display: inline-block;
      position: relative;
      transition: 0.5s;
    }
    
    .button span:after {
      content: '»';
      position: absolute;
      opacity: 0;
      top: 0;
      right: -20px;
      transition: 0.5s;
    }
    
    .button:hover span {
      padding-right: 25px;
    
    }
    
    .button:hover span:after {
      opacity: 1;
      right: 0;
    }
    /*禁用按钮*/
    .disabled {
        opacity: 0.6;
        cursor: not-allowed;
    }
    .button2 {
        position: relative;
        background-color: #4CAF50;
        border: none;
        font-size: 28px;
        color: #FFFFFF;
        padding: 20px;
        width: 200px;
        text-align: center;
        -webkit-transition-duration: 0.4s; /* Safari */
        transition-duration: 0.4s;
        text-decoration: none;
        overflow: hidden;
        cursor: pointer;
    }
    .button2:after {
        content: "";
        background: #90EE90;
        display: block;
        position: absolute;
        padding-top: 300%;
        padding-left: 350%;
        margin-left: -20px!important;
        margin-top: -120%;
        opacity: 0;
        transition: all 0.8s
    }
    
    .button2:active:after {
        padding: 0;
        margin: 0;
        opacity: 1;
        transition: 0s
    }
    /*下压特效*/
    .button3 {
      display: inline-block;
      padding: 15px 25px;
      font-size: 24px;
      cursor: pointer;
      text-align: center;   
      text-decoration: none;
      outline: none;
      color: #fff;
      background-color: #4CAF50;
      border: none;
      border-radius: 15px;
      box-shadow: 0 9px #999;
    }
    
    .button3:hover {background-color: #3e8e41}
    
    .button3:active {
      background-color: #3e8e41;
      box-shadow: 0 5px #666;
      transform: translateY(4px);
    }
    </style>
    </head>
    <body>
    
    <h2>按钮</h2>
    
    <button class="button" style="vertical-align:middle"><span>Hover </span></button>
    <button class="button disabled" style="vertical-align:middle">按钮禁用</button>
    <button class="button2" style="vertical-align:middle">点击特效</button>
    <button class="button3" style="vertical-align:middle">下压特效</button>
    </body>
    </html>
  • 相关阅读:
    visual studio 2019 企业版下载
    对IT战略的认识
    投融资,你了解吗?
    一品投资农副产品电商平台工作内容
    高明的决策和投资远比低效的勤奋更重要
    随笔
    思维方式的不同
    公司经营问题探讨
    盘点海口最好吃的西餐厅top10
    羽毛球运动技巧
  • 原文地址:https://www.cnblogs.com/minchao/p/6088769.html
Copyright © 2011-2022 走看看