Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-02-18 07:58:33

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Advanced CSS help needed: generated content and counters

<pre><code>ol#comments li span.counter:before {
content: counter(comment);
counter-increment: comment;
}</code></pre>

The numbers are generated, but they won’t increment, they just reset (each comes out as the number 1). What am I doing wrong?

Offline

#2 2006-02-18 08:30:08

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,122
Website GitHub Mastodon Twitter

Re: Advanced CSS help needed: generated content and counters

Hi mary, I’m not sure if this will help. It is from the <a href=“http://www.w3schools.com/css/pr_gen_counter-increment.asp”>w3 schools</a>

<pre>h1:before
{
content: “Section “ counter(section) “ “;
/* Add 1 to section */
counter-increment: section;
}

A way to number sections with “Section 1”, “Section 3”, “Section 5” etc.:

h1:before
{
content: “Section “ counter(section) “ “;
/* Add 2 to section */
counter-increment: section 2;
}</pre>

so yours might become:

<pre>ol#comments li span.counter:before {
content: “counter(comment)” “”;
counter-increment: comment;
}</pre>

Last edited by colak (2006-02-18 08:30:53)


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#3 2006-02-18 08:49:59

Cyrus
Member
From: MY
Registered: 2005-01-09
Posts: 14
Website

Re: Advanced CSS help needed: generated content and counters

I had done this before with the following codes :

h5 { counter-increment: mh-demo;
}

h5:before { content: “#” counter(mh-demo) “ “;
}

Hopefully this could helps you~

Offline

#4 2006-02-19 00:31:39

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: Advanced CSS help needed: generated content and counters

Thanks guys, I got it fixed! Here’s what it needed to be:

<pre><code>ol#comments li {
counter-increment: comment;
}

ol#comments li span.counter:before {
content: counter(comment);
}</code></pre>

Thanks again!

Offline

Board footer

Powered by FluxBB