ใช้ Selector [attribute="value"] เพื่อเลือกอิลิเมนต์ที่มีแอตทริบิวต์และค่าที่ระบุ
ตัวอย่างโค้ด
ลองรันโค้ดด้านล่างเพื่อทดสอบ CSS [attribute="value"] Selector โดยใช้แอตทริบิวต์ rel:
<!DOCTYPE html>
<html>
<head>
<style>
a[rel="nofollow"] {
border: 3px solid blue;
}
</style>
</head>
<body>
<a href="https://qries.com/What-is-Uber-s-business-model-and-how-does-it-compare-with-Ola-s-model-in-India" rel="nofollow">Uber's Business Model</a><br><br>
<a href="https://www.qries.com/How-does-share-market-work-in-India" rel="noreferrer">Share Market</a>
</body>
</html>
ผลลัพธ์: ลิงก์แรกจะมีขอบสีน้ำเงินเพราะมี rel="nofollow" ลิงก์ที่สองมี rel="noreferrer" จึงไม่ตรงเงื่อนไข