使用 CSS 返回所选元素的属性值
cssweb developmentfront end technology更新于 2025/7/4 21:00:17
attr() CSS 函数使用 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>
相关文章
有用资源
css 参考教程 - 该教程包含有关 css 的更多信息:https://www.cainiaomax.com/css/

