Skip to content

Instantly share code, notes, and snippets.

@LeaVerou
Created April 30, 2013 19:50
Show Gist options
  • Save LeaVerou/5491400 to your computer and use it in GitHub Desktop.
Save LeaVerou/5491400 to your computer and use it in GitHub Desktop.
Counters for Doug
/**
* Counters for Doug
*/
.main-box,
.sub-box {
display: inline-block;
margin: 10px;
padding: 10px;
}
.main-box:not(.container-box),
.sub-box {
background: beige;
width: 100px;
height: 100px;
}
.container-box {
background: pink;
}
body {
counter-reset: main-box;
max-width: 500px;
}
.main-box {
counter-increment: main-box;
}
.main-box:before {
content: counter(main-box);
font-weight: bold;
}
<div class="main-box">A</div>
<div class="main-box">B</div>
<div class="main-box">C</div>
<div class="main-box container-box">
<div class="sub-box">D</div>
<div class="sub-box">E</div>
<div class="sub-box">F</div>
</div>
// alert('Hello world!');
{"view":"split-vertical","fontsize":"100","seethrough":"","prefixfree":"1","page":"css"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment