Home  >  Article  >  Web Front-end  >  Return the property value of a selected element using CSS

Return the property value of a selected element using CSS

王林
王林forward
2023-09-15 15:05:101424browse

使用 CSS 返回所选元素的属性值

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

Example

You can try running the following code to implement the attr() function

Real-time demonstration

<!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>

The above is the detailed content of Return the property value of a selected element using CSS. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete