Foundation - 按鈕著色



說明

可以對按鈕進行著色,以使其具有附加含義。可以使用 .disabled 類停用按鈕,該類將按鈕顯示為淡化狀態,且不會停用控制元件。如果你要停用 <button> 元素,請向其新增 disabled 屬性。如果你要停用連結,請新增 aria-disabled 屬性。

示例

以下示例演示如何在 Foundation 中對按鈕著色。

<html>
   <head>
      <title>Button Coloring</title>
      <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/foundation-sites@6.5.1/dist/css/foundation.min.css" crossorigin="anonymous">

   </head>

   <body>
      <a class = "secondary button" href = "#">Secondary</a>

      <button type = "button" class = "success button">Success</button>
      <button type = "button" class = "alert button">Alert</button>

      <a class = "warning button" href = "#">Warning</a>
      <a class = "disabled button" href = "#">Disabled</a>
      <button type = "button" class = "disabled button">Disabled</button>

      <script src = "https://cdnjs.cloudflare.com/ajax/libs/foundation/6.0.1/js/vendor/jquery.min.js"></script>
      <script src = "https://cdnjs.cloudflare.com/ajax/libs/foundation/6.0.1/js/foundation.min.js"></script>

      <script>
         $(document).ready(function() {
            $(document).foundation();
         })
      </script>
   </body>
</html>

輸出

執行以下步驟,瞭解上述程式碼的工作原理:

  • 儲存以上給出的 html 程式碼 button_coloring.html 檔案。

  • 在瀏覽器中開啟該 HTML 檔案,將顯示如下所示的輸出。

foundation_basic_controls.htm
廣告
© . All rights reserved.