基礎 - 多個 ID 標籤



描述

如果多個標籤描述一個元素,則必須在 aria-describedby 屬性中放置多個 ID。

示例

以下示例演示如何在基礎中使用多個標籤

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

      <!-- Compressed JavaScript -->
      <script src="https://cdnjs.cloudflare.com/ajax/libs/foundation/6.0.1/js/vendor/jquery.min.js"></script>
      <script src="https://cdn.jsdelivr.net/npm/foundation-sites@6.5.1/dist/js/foundation.min.js" crossorigin="anonymous"></script>

   </head>

   <body>
      <p aria-describedby = "email1 email2">Re: re: A Christmas gift for you!</p>
      <span class = "label" id = "emaill">Maximum Priority</span>
      <span class = "label" id = "email2">Unread</span>

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

</html>

輸出

讓我們執行以下步驟,瞭解上面給出的程式碼如何工作的 -

  • 儲存上面給出的 html 程式碼 label_multipleID.html 檔案。

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

foundation_media.htm
廣告
© . All rights reserved.