【问题标题】:Styling buttons with css使用 css 设置按钮样式
【发布时间】:2011-09-17 01:52:38
【问题描述】:

我将按钮设置为看起来像超链接,因此我可以使用 request.post 而不是 querystring。唯一的问题是在选择某些字符时有点困难,因为文本框的区域是字母本身(例如 - 字符 i)。有没有办法在不更改超链接的情况下解决这个问题?我还在下面提供了样式按钮

<input type="submit" name="Page" value="#" style="background:transparent;border:0;display:inline;color:#00F;text-decoration:underline;padding:0px;cursor:pointer">
    <% for i = 97 to 122 %>     
         <input type="submit" name="Page" value="<%=CHR(i) %>" style="background:transparent;border:0;display:inline;color:#00F;text-decoration:underline;padding:0px;cursor:pointer;">&nbsp;
    <% next %>

【问题讨论】:

  • 保持块级元素,那么整个按钮应该是可点击的。

标签: html css vbscript asp-classic pagination


【解决方案1】:

尝试使用 display:block;并设置宽度。

或者,您可以增加设置为 0 像素的内边距。

【讨论】:

    【解决方案2】:

    这里有一些按钮样式 HTML+CSS(不需要样式):

    悬停:

    <!DOCTYPE html>
    <html>
    <head>
    <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;
    }
    
    .button span {
      cursor: pointer;
      display: inline-block;
      position: relative;
      transition: 0.5s;
    }
    
    .button span:after {
      content: '\00bb';
      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;
    }
    </style>
    </head>
    <body>
    
    <h2>Animated Button</h2>
    
    <button class="button" style="vertical-align:middle"><span>Hover </span></button>
    
    </body>
    </html>

    点击:

    <!DOCTYPE html>
    <html>
    <head>
    <style>
    .button {
      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;
    }
    
    .button:hover {background-color: #3e8e41}
    
    .button:active {
      background-color: #3e8e41;
      box-shadow: 0 5px #666;
      transform: translateY(4px);
    }
    </style>
    </head>
    <body>
    
    
    <button class="button">Click Me</button>
    
    </body>
    </html>

    淡入:

    <!DOCTYPE html>
    <html>
    <head>
    <style>
    .button {
      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;
    }
    
    .button:hover {background-color: #3e8e41}
    
    .button:active {
      background-color: #3e8e41;
      box-shadow: 0 5px #666;
      transform: translateY(4px);
    }
    </style>
    </head>
    <body>
    
    
    <button class="button">Click Me</button>
    
    </body>
    </html>

    涟漪:

    <!DOCTYPE html>
    <html>
    <head>
    <style>
    .button {
        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;
    }
    
    .button:after {
        content: "";
        background: #f1f1f1;
        display: block;
        position: absolute;
        padding-top: 300%;
        padding-left: 350%;
        margin-left: -20px !important;
        margin-top: -120%;
        opacity: 0;
        transition: all 0.8s
    }
    
    .button:active:after {
        padding: 0;
        margin: 0;
        opacity: 1;
        transition: 0s
    }
    </style>
    </head>
    <body>
    
    
    <button class="button">Click Me</button>
    
    </body>
    </html>

    希望这会有所帮助。

    【讨论】:

      【解决方案3】:

      使用这个:D

      这是创建一些按钮的简单方法。运行代码sn -p:

      button {
        font-size: 150%;
        margin-right: 50px;
        margin-bottom: 50px;
        padding: 10px;
        border-radius: 10px;
        background-color: transparent;
        font-weight: lighter;
        transition: all 0.3s;
        box-shadow: silver 3px 3px 3px 0;
      }
      
      /*
          Button number "one"
      */
      
      #one {
        color: #00d5ff;
        border: 1px solid #00d5ff;
      }
      
      #one:hover {
        color: white;
        background-color: #00d5ff;
      }
      
      /*
          Button number "two"
      */
      
      #two {
        color: #b50000;
        border: 1px solid #b50000;
      }
      
      #two:hover {
        color: white;
        background-color: #b50000;
      }
      
      /*
          Button number "three"
      */
      
      #three {
        color: #00ff2f;
        border: 1px solid #00ff2f;
      }
      
      #three:hover {
        color: white;
        background-color: #00ff2f;
      }
      
      /*
          Button number "four"
      */
      
      #four {
        color: #2f00ff;
        border: 1px solid #2f00ff;
      }
      
      #four:hover {
        color: white;
        background-color: #2f00ff;
      }
      
      /*
          Button number "five"
      */
      
      #five {
        color: #ff00bb;
        border: 1px solid #ff00bb;
      }
      
      #five:hover {
        color: white;
        background-color: #ff00bb;
      }
      
      /*
          Button number "six"
      */
      
      #six {
        color: #ff0000;
        border: 1px solid #ff0000;
      }
      
      #six:hover {
        color: white;
        background-color: #ff0000;
      }
      
      /*
          Button number "seven"
      */
      
      #seven {
        color: #ff8c00;
        border: 1px solid #ff8c00;
      }
      
      #seven:hover {
        color: white;
        background-color: #ff8c00;
      }
      
      /*
          Button number "eight"
      */
      
      #eight {
        color: #ffee00;
        border: 1px solid #ffee00;
      }
      
      #eight:hover {
        color: white;
        background-color: #ffee00;
      }
      
      /*
          Button number "nine"
      */
      
      #nine {
        color: #26ff00;
        border: 1px solid #26ff00;
      }
      
      #nine:hover {
        color: white;
        background-color: #26ff00;
      }
      
      /*
          Button number "ten"
      */
      
      #ten {
        color: #00a2ff;
        border: 1px solid #00a2ff;
      }
      
      #ten:hover {
        color: white;
        background-color: #00a2ff;
      }
      <button id="one">1. Button</button>
      <button id="two">2. Button</button>
      <button id="three">3. Button</button>
      <button id="four">4. Button</button>
      <button id="five">5. Button</button>
      <button id="six">6. Button</button>
      <button id="seven">7.Button</button>
      <button id="eight">8. Button</button>
      <button id="nine">9. Button</button>
      <button id="ten">10. Button</button> 

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-08-24
        • 2021-04-12
        • 1970-01-01
        • 1970-01-01
        • 2011-05-08
        相关资源
        最近更新 更多