Skip to content

Instantly share code, notes, and snippets.

@kushalseth
Created August 9, 2020 16:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kushalseth/b0f9ad81c62c56573a810c1056ff0110 to your computer and use it in GitHub Desktop.
Save kushalseth/b0f9ad81c62c56573a810c1056ff0110 to your computer and use it in GitHub Desktop.
Advanced CSS Selectors GIST
<!DOCTYPE html>
<html>
<head>
<style>
p[data-test] {
background-color: yellow;
}
a[target] {
background-color: orange;
}
</style>
</head>
<body>
<h1>This is h1 directly under body</h1>
<p class="abc-myclass"> Test class attribute para </p>
<div>
<h2>I am h2 directly under div</h2>
<p data-test="001">This is para inside div, but not directly inside div</p>
</div>
<div>
<p class="abc-myclass">This is para directly inside div</p>
<span><p>This is para inside span</p></span>
</div>
<p class="myclass" data-test="001">I am paragraph directly inside the body and below a div</p>
<a href="github.com/kushalseth" target="_blank">GIT rofile</p>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment