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

จัดสไตล์ลิงก์ที่กำลังคลิกอยู่ (active) ด้วย CSS


Pseudo-class :active

ใช้ :active เพื่อจัดสไตล์ลิงก์ในขณะที่กำลังถูกคลิก (mouse down)

ตัวอย่าง

<!DOCTYPE html>
<html>
<head>
  <style>
    a:active {
      background-color: green;
    }
  </style>
</head>
<body>
  <a href="https://qries.com">Welcome to Qries</a>
  <p>Click on the above link to see the effect.</p>
</body>
</html>