Skip to content

Instantly share code, notes, and snippets.

@mkonikov
Created December 10, 2020 17:08
Show Gist options
  • Save mkonikov/6a935b893ce04271f56d24a349a5aada to your computer and use it in GitHub Desktop.
Save mkonikov/6a935b893ce04271f56d24a349a5aada to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<title>CSS query</title>
</head>
<style>
/*
target only element with ID "pickme"
target elements with CSS class "even"
target only elements with data-foo="bar"
target only elements of class "even" that have no data attribute
target the last div inside each <div class="wrapper">
target all <p> that come AFTER a <div>
*/
</style>
<body>
View Source. Update the CSS to create selectors that target only the elements specified in the comments.<br /><br />
<div class="wrapper">
<div class="odd">odd</div>
<div class="even" data-foo="bar">even</div>
<div class="odd" id="pickme">odd</div>
<div class="even">even</div>
<p class="odd" data-foo="bar">odd</p>
<p class="even">even</p>
</div>
<div class="wrapper">
<p class="even">even</p>
<div class="odd" data-foo="bar">odd</div>
<div class="even" data-foo="baz">even</div>
<p class="odd">odd</p>
<p class="even" data-foo="bar">even</p>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment