CSS attr() फ़ंक्शन चयनित तत्व के किसी एट्रिब्यूट का मान लौटाता है, जिसे content प्रॉपर्टी के साथ उपयोग किया जा सकता है।
उदाहरण
<!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>
व्याख्या: a:before में attr(href) लिंक के href एट्रिब्यूट का मान लाता है और उसे कोष्ठक में लिंक से पहले दिखाता है।