Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> CSS

จัดสไตล์ลิงก์ที่เยี่ยมชมแล้วทั้งหมดด้วย CSS


Pseudo-class :visited

ใช้ :visited จัดสไตล์ลิงก์ที่เคยถูกคลิกแล้ว (ร่วมกับ :link สำหรับสถานะปกติ)

ตัวอย่าง

<!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>