使用 CSS 設定所有已訪問連結的樣式


要設定所有已訪問連結的樣式,請使用 CSS :visited 選擇器。

示例

你可以嘗試執行以下程式碼以實現 :visited 選擇器

線上示例

<!DOCTYPE html>
<html>
   <head>
      <style>
         a:link, a:visited {
            background-color: white;
            color: black;
            border: 1px solid blue;
            padding: 30px 30px;
            text-align: center;
            text-decoration: none;
            display: inline-block;
         }
         a:hover, a:active {
            background-color: red;
            color: white;
         }
      </style>
   </head>
   <body>
      <a href = "demo.html" target="_blank">Demo Link</a>
   </body>
</html>

更新於:2020 年 7 月 1 日

448 次瀏覽

開啟你的職業生涯

透過完成課程來獲得認證

開始學習
廣告
© . All rights reserved.