Skip to content

Instantly share code, notes, and snippets.

@akdetrick
Created August 6, 2013 23:57
Show Gist options
  • Select an option

  • Save akdetrick/6170028 to your computer and use it in GitHub Desktop.

Select an option

Save akdetrick/6170028 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>selector test</title>
<!--<link rel="stylesheet" type="text/css" href="../static/style.css" />-->
<style type="text/css">
#pageWrap {
width: 960px;
margin: 16px auto;
}
h5 ~ div {
color: red;
}
</style>
</head>
<body>
<div id="pageWrap">
<h1>This is an h1</h1>
<h5>an h5 tag, acting as the root of the CSS rule "h5 ~ div { color: red; }"</h5>
<h2>this is an h2</h2>
<p>i don't love paragraphs outside divs</p>
<div>
<p>i love paragraphs inside of divs (the parent div is the first direct sibling of the h5)</p>
</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment