Comments on: counter-increment https://css-tricks.com Tips, Tricks, and Techniques on using Cascading Style Sheets. Thu, 31 Jan 2019 14:24:07 +0000 hourly 1 https://wordpress.org/?v=6.6.1 By: Aaron Davidson https://css-tricks.com/almanac/properties/c/counter-increment/#comment-1614591 Sun, 14 Jan 2018 23:05:09 +0000 http://css-tricks.com/?page_id=14033#comment-1614591 There’s a big undocumented aspect to using multiple CSS counters which this pen demonstrates https://codepen.io/A2D/pen/WdKjRa
That’s neither how I expected it to work, nor how I think it should work.

]]>
By: Santosh https://css-tricks.com/almanac/properties/c/counter-increment/#comment-1606924 Tue, 21 Feb 2017 07:10:09 +0000 http://css-tricks.com/?page_id=14033#comment-1606924 In reply to mahantesh.

@transGLUKator Thanks for the note.

But can you explain why the article demo as the counter reset value seperated by commas ?

]]>
By: Rahul https://css-tricks.com/almanac/properties/c/counter-increment/#comment-1604220 Tue, 20 Sep 2016 14:14:27 +0000 http://css-tricks.com/?page_id=14033#comment-1604220 Here is youtube video tutorial, i explained this in little detail with examples. :)
https://goo.gl/Jw2TDD

]]>
By: James https://css-tricks.com/almanac/properties/c/counter-increment/#comment-1601845 Sun, 29 May 2016 02:46:54 +0000 http://css-tricks.com/?page_id=14033#comment-1601845 In reply to James.

It was an issue with the Google Maps API rendering two sets of markers. So I just limited the counter to the first set of .MarkerLabels.

]]>
By: James https://css-tricks.com/almanac/properties/c/counter-increment/#comment-1601841 Sat, 28 May 2016 21:10:14 +0000 http://css-tricks.com/?page_id=14033#comment-1601841 I’ve run into an issue where I have code like so:

#map { counter-reset: markerLabel; }
#map .MarkerLabel {

    counter-increment: markerLabel;

    &::before {  content: ~"counter(markerLabel)";  }
    &:hover {  /* stuff */ }

}

This works no problem on page load. The problem I’m running into is whenever I hover over .MarkerLabel, it seems to be inserting an additional ::before pseudo element inside the .MarkerLabel. So I end up with the original ::before pseudo element that has a counter value of 1 and then when I hover, a second pseudo element appears with a counter value (in this case) of 54, like it’s doing it all over again on hover. Make no sense to me. Anyone else run into issues with :hover and the CSS counter?

]]>
By: James https://css-tricks.com/almanac/properties/c/counter-increment/#comment-1601840 Sat, 28 May 2016 21:02:29 +0000 http://css-tricks.com/?page_id=14033#comment-1601840 In reply to Shaun.

Couldn’t you just wrap it up inside an anchor tag?

<a class="counter-link"><a/>

Then in your css, try something like..

.counter-link {
    &::before {
        content: counter(NAME_OF_COUNTER);
    }
}
]]>
By: James https://css-tricks.com/almanac/properties/c/counter-increment/#comment-1601839 Sat, 28 May 2016 20:58:39 +0000 http://css-tricks.com/?page_id=14033#comment-1601839 In reply to Will.

I’m almost certain that ‘counter’ only works within the ‘content’ property on pseudo elements (e.g. ::before, ::after)

]]>
By: Shaun https://css-tricks.com/almanac/properties/c/counter-increment/#comment-1596707 Tue, 01 Sep 2015 15:12:49 +0000 http://css-tricks.com/?page_id=14033#comment-1596707 is there any technique or advice on how to make the counters clickable links? I can’t see how but I’ve been asked to do so on an already established design.

]]>
By: transGLUKator https://css-tricks.com/almanac/properties/c/counter-increment/#comment-1587041 Wed, 26 Nov 2014 14:17:35 +0000 http://css-tricks.com/?page_id=14033#comment-1587041 In reply to mahantesh.

I have edited your code a bit so it is actually working.

http://codepen.io/anon/pen/ZYGrJv

You have to move counter-increment property from li:before to li itself. Also in counter-reset property you cannot use commas, just spaces to separate values.

]]>
By: Will https://css-tricks.com/almanac/properties/c/counter-increment/#comment-1585469 Tue, 23 Sep 2014 13:28:54 +0000 http://css-tricks.com/?page_id=14033#comment-1585469 Is it possible to use it like this:

div:nth-child(counter(item)) {
    z-index:counter(item);
}

I can’t get it working, would be nice if it would work that way also.

]]>
By: mahantesh https://css-tricks.com/almanac/properties/c/counter-increment/#comment-1585075 Sat, 06 Sep 2014 15:25:04 +0000 http://css-tricks.com/?page_id=14033#comment-1585075 Event without script we can change number of li with counter-increament
http://codepen.io/nakati/pen/lhzKb

]]>
By: arnold https://css-tricks.com/almanac/properties/c/counter-increment/#comment-1581328 Sat, 17 May 2014 16:19:56 +0000 http://css-tricks.com/?page_id=14033#comment-1581328 hmm it looks like Android and iOS has a good support too.

caniuse.com

]]>
By: Chris Bier https://css-tricks.com/almanac/properties/c/counter-increment/#comment-1580621 Thu, 01 May 2014 19:24:02 +0000 http://css-tricks.com/?page_id=14033#comment-1580621 The guy drove home without paying for the skirt steak! haha

]]>