ฟังก์ชัน attr() CSS ส่งคืนค่าแอตทริบิวต์ขององค์ประกอบที่เลือกโดยใช้ CSS
ตัวอย่าง
คุณสามารถลองเรียกใช้โค้ดต่อไปนี้เพื่อใช้ฟังก์ชัน attr() ใน CSS
<!DOCTYPE html>
<html>
<head>
<style>
a:before {content: " (" attr(href) ")";}
</style>
</head>
<body>
<h2>Information Resource</h2>
<p>
Resource:<a href="https://www.qries.com">Welcome to Qries </a>
</p>
</body>
</html>