CSS attr() 函数的用法

cssweb developmentfront end technology更新于 2024/9/7 6:36:17

CSS attr() 函数使用 CSS 返回所选元素属性的值

您可以尝试运行以下代码,在 CSS 中实现 attr() 函数

示例

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

相关文章


有用资源