Return the value of an attribute of the selected element using CSS

CSSWeb DevelopmentFront End Technology

The attr() CSS function returns the value of an attribute of the selected element using CSS

Example

You can try to run the following code to implement the attr() function in CSS

Live Demo

<!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>
raja
Published on 31-May-2018 14:23:06
Advertisements