Skip to content

Commit

Permalink
fix counter.md
Browse files Browse the repository at this point in the history
  • Loading branch information
atomiks committed Mar 10, 2018
1 parent aa9ebf0 commit 4fc1d76
Showing 1 changed file with 28 additions and 26 deletions.
54 changes: 28 additions & 26 deletions snippets/counter.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ Counters are, in essence, variables maintained by CSS whose values may be increm
<div class="countable-item">
<p>Some item</p>
<div class="countable-section">
<p>First sub item</p>
<p>Second sub item</p>
<p>Third sub item</p>
<p>First sub item</p>
<p>Second sub item</p>
<p>Third sub item</p>
</div>
</div>
<div class="countable-item">
Expand Down Expand Up @@ -43,36 +43,38 @@ Counters are, in essence, variables maintained by CSS whose values may be increm

#### Demo

<section class="countable-section">
<div class="countable-item">
<p>Some item</p>
<div class="countable-section">
<p>First sub item</p>
<p>Second sub item</p>
<p>Third sub item</p>
<div class="snippet-demo">
<section class="snippet-demo__countable-section">
<div class="snippet-demo__countable-item">
<p>Some item</p>
<div class="snippet-demo__countable-section">
<p>First sub item</p>
<p>Second sub item</p>
<p>Third sub item</p>
</div>
</div>
</div>
<div class="countable-item">
<p>Second other item</p>
</div>
<div class="countable-item">
<p>Third item</p>
</div>
<div class="countable-item">
<p>Fourth item</p>
</div>
</section>
<div class="snippet-demo__countable-item">
<p>Second other item</p>
</div>
<div class="snippet-demo__countable-item">
<p>Third item</p>
</div>
<div class="snippet-demo__countable-item">
<p>Fourth item</p>
</div>
</section>
</div>

<style>
.countable-section {
.snippet-demo__countable-section {
counter-reset: counter1;
}
.countable-item p {
.snippet-demo__countable-item p {
counter-increment: counter1;
}
.countable-item p:before {
.snippet-demo__countable-item p:before {
content: counters(counter1, '.') ' ';
font-weight: bold; /* for better visualization on demo */
font-weight: bold;
}
</style>

Expand All @@ -96,4 +98,4 @@ You can create a ordered list using any type of HTML.

* https://caniuse.com/#search=counters

<!-- tags: visual -->
<!-- tags: visual, other -->

0 comments on commit 4fc1d76

Please sign in to comment.