Skip to content

Instantly share code, notes, and snippets.

@xdesro
Created April 29, 2022 14:49
Show Gist options
  • Save xdesro/35e153ca60958834ac2520f52c28d5e1 to your computer and use it in GitHub Desktop.
Save xdesro/35e153ca60958834ac2520f52c28d5e1 to your computer and use it in GitHub Desktop.
You can apparently use CSS :has() to read meta tags of a page.
<html lang="en">
<head>
<meta name="description" content="This is a test.">
<style>
head:has(meta[content^="This is a test."]) + body div:before {
content: "The description of this page is 'This is a test.'";
}
</style>
</head>
<body>
<div></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment