使用 CSS 建立停用外觀按鈕


若要建立停用按鈕外觀,請使用 CSS 不透明度屬性。

示例

您可以嘗試執行以下程式碼,以建立停用按鈕外觀 −

即時演示

<!DOCTYPE html>
<html>
    <head>
      <style>
         .btn1 {
            color: black;
            text-align: center;
            font-size: 15px;
         }
         .btn2 {
            color: black;
            text-align: center;
            font-size: 15px;
            opacity: 0.5;
         }
      </style>
   </head>
   <body>
      <h2>Result</h2>
      <p>Click below for result:</p>
      <button class = "btn1">Enabled</button>
      <button class = "btn2">Disabled</button>
   </body>
</html>

更新於: 03-Jul-2020

317 次瀏覽

開啟職業生涯

完成教程,獲得認證

開始學習
廣告