{"id":9889,"date":"2026-06-03T10:34:51","date_gmt":"2026-06-03T15:34:51","guid":{"rendered":"https:\/\/frontendmasters.com\/blog\/?p=9889"},"modified":"2026-06-03T10:34:52","modified_gmt":"2026-06-03T15:34:52","slug":"obscuring-text-with-counter-style","status":"publish","type":"post","link":"https:\/\/frontendmasters.com\/blog\/obscuring-text-with-counter-style\/","title":{"rendered":"Obscuring Text with @counter-style"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">The <code>@counter-style<\/code>\u00a0at-property in CSS helps us shift from browser defaults to user-defined web styling for list markers. Like instead of the bullet-points of unordered lists and numbers of ordered lists, you can define any marker glyphs you want. But it&#8217;s uses extend beyond that, and we&#8217;re going to use it for some trickery in this article.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">List <strong>markers<\/strong> are the characters that precede each new entry in a list. They can be numbers, bullet symbols, or letters, typically denoting the position of each item in an ordered list.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">However,\u00a0<code>@counter-style<\/code>\u00a0allows us to use characters that aren\u2019t part of the usual styles as markers. Since these markers represent a <strong>count<\/strong>, they can produce a string defined by the marker style using\u00a0<a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/CSS\/Guides\/Counter_styles\/Using_counters\">CSS counter<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">While typically used for bulleting lists, this spawning of text can come handy in various ways, like generating a sequence of characters to hide data or to create a word rotator. We won\u2019t have to manually put together the sequence:&nbsp;<code>@counter-style<\/code>&nbsp;does it for us.<\/p>\n\n\n\n<div class=\"wp-block-cp-codepen-gutenberg-embed-block cp_embed_wrapper\"><iframe id=\"cp_embed_gbLrjgO\" src=\"\/\/codepen.io\/anon\/embed\/gbLrjgO?height=650&amp;theme-id=1&amp;slug-hash=gbLrjgO&amp;default-tab=result\" height=\"650\" scrolling=\"no\" frameborder=\"0\" allowfullscreen allowpaymentrequest name=\"CodePen Embed gbLrjgO\" title=\"CodePen Embed gbLrjgO\" class=\"cp_embed_iframe\" style=\"width:100%;overflow:hidden\">CodePen Embed Fallback<\/iframe><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">What is&nbsp;<code>@counter-style<\/code>?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Although this at-rule is made up of a long list of&nbsp;<a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/CSS\/Reference\/At-rules\/@counter-style#descriptors\">descriptors<\/a>, the most crucial one to understand is the&nbsp;<code>system<\/code>&nbsp;\u2014 the algorithm used to convert the integer to a string.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css\"><span class=\"hljs-keyword\">@counter-style<\/span> &lt;counter-style-name&gt; { \n  <span class=\"hljs-selector-tag\">system<\/span>: &lt;<span class=\"hljs-selector-tag\">system-type<\/span>&gt;; \n  <span class=\"hljs-selector-tag\">symbols<\/span>: &lt;<span class=\"hljs-selector-tag\">symbol<\/span>&gt;+; \n}<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\">In this article, you\u2019ll learn about these algorithms and explore different ways to utilize them. The default value for\u00a0<code>system<\/code>\u00a0is\u00a0<code>symbolic<\/code>, where\u00a0<code>symbols<\/code>\u00a0(the characters) are looped and multiplied to represent increasing values of the integer count.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Using\u00a0<code>@counter-style<\/code> as a list\u2019s counter style<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">To use\u00a0<code>@counter-style<\/code>\u00a0as a list\u2019s counter style, follow these steps:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Define the counter style using the syntax provided above.<\/li>\n\n\n\n<li>Apply the counter style to the list element using the&nbsp;<code>list-style<\/code>&nbsp;property.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">For example:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css\"><span class=\"hljs-keyword\">@counter-style<\/span> ab-loop { \n  <span class=\"hljs-comment\">\/* system: symbolic; is the default *\/<\/span>\n  <span class=\"hljs-selector-tag\">symbols<\/span>: <span class=\"hljs-selector-tag\">a<\/span> <span class=\"hljs-selector-tag\">b<\/span>; \n}\n<span class=\"hljs-selector-tag\">ol<\/span> {\n  <span class=\"hljs-attribute\">list-style<\/span>: ab-loop;\n}<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\">When used as a list style, the result will be a sequence of characters that precede the items in the list.<\/p>\n\n\n\n<div class=\"wp-block-cp-codepen-gutenberg-embed-block cp_embed_wrapper\"><iframe id=\"cp_embed_EaNvxJY\" src=\"\/\/codepen.io\/anon\/embed\/EaNvxJY?height=500&amp;theme-id=1&amp;slug-hash=EaNvxJY&amp;default-tab=css,result\" height=\"500\" scrolling=\"no\" frameborder=\"0\" allowfullscreen allowpaymentrequest name=\"CodePen Embed EaNvxJY\" title=\"CodePen Embed EaNvxJY\" class=\"cp_embed_iframe\" style=\"width:100%;overflow:hidden\">CodePen Embed Fallback<\/iframe><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Both of the symbols (a and b) are rotated through, and during each rotation they multiply. For a single character (one symbol), it goes like this:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css\"><span class=\"hljs-keyword\">@counter-style<\/span> a-loop { \n  <span class=\"hljs-comment\">\/* system: symbolic; is the default *\/<\/span>\n  <span class=\"hljs-selector-tag\">symbols<\/span>: <span class=\"hljs-selector-tag\">a<\/span>; \n}\n<span class=\"hljs-selector-tag\">ol<\/span> {\n  <span class=\"hljs-attribute\">list-style<\/span>: a-loop;\n}<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<div class=\"wp-block-cp-codepen-gutenberg-embed-block cp_embed_wrapper\"><iframe id=\"cp_embed_azBybMb\" src=\"\/\/codepen.io\/anon\/embed\/azBybMb?height=500&amp;theme-id=1&amp;slug-hash=azBybMb&amp;default-tab=css,result\" height=\"500\" scrolling=\"no\" frameborder=\"0\" allowfullscreen allowpaymentrequest name=\"CodePen Embed azBybMb\" title=\"CodePen Embed azBybMb\" class=\"cp_embed_iframe\" style=\"width:100%;overflow:hidden\">CodePen Embed Fallback<\/iframe><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Using&nbsp;<code>@counter-style<\/code>&nbsp;as a generic counter style<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Say, for a count of 8, we get a sequence of eight \u2018a\u2019s. We can print these \u2018a\u2019s independently using\u00a0<code>counter()<\/code>\u00a0and\u00a0<code>content<\/code>. We don\u2019t need a list item to display them.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css\"><span class=\"hljs-selector-tag\">div<\/span><span class=\"hljs-selector-pseudo\">::after<\/span> {\n  <span class=\"hljs-attribute\">display<\/span>: block;\n  <span class=\"hljs-attribute\">counter-set<\/span>: n <span class=\"hljs-number\">8<\/span>;\n  <span class=\"hljs-attribute\">content<\/span>: <span class=\"hljs-built_in\">counter<\/span>(n, a-loop);\n}<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<div class=\"wp-block-cp-codepen-gutenberg-embed-block cp_embed_wrapper\"><iframe id=\"cp_embed_ogYeNRx\" src=\"\/\/codepen.io\/anon\/embed\/ogYeNRx?height=450&amp;theme-id=1&amp;slug-hash=ogYeNRx&amp;default-tab=result\" height=\"450\" scrolling=\"no\" frameborder=\"0\" allowfullscreen allowpaymentrequest name=\"CodePen Embed ogYeNRx\" title=\"CodePen Embed ogYeNRx\" class=\"cp_embed_iframe\" style=\"width:100%;overflow:hidden\">CodePen Embed Fallback<\/iframe><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">This is the approach we\u2019ll use in our examples.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">A Sequence of the Same Character<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Method 1: Counter Value<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">In our first example, we hide the first 12 digits (3 blocks of 4 digits, separated by a space) of a credit card number with dots. These dots are overlaid on the credit card number, keeping it hidden until needed.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"HTML, XML\" data-shcb-language-slug=\"xml\"><span><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span> <span class=\"hljs-attr\">id<\/span>=<span class=\"hljs-string\">\"number\"<\/span>&gt;<\/span>\n  1234 5678 9123 4567\n<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">HTML, XML<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">xml<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css\"><span class=\"hljs-keyword\">@counter-style<\/span> dot {\n  <span class=\"hljs-comment\">\/* system: symbolic; is the default *\/<\/span>\n  <span class=\"hljs-selector-tag\">symbols<\/span>: '\\2022';\n}\n<span class=\"hljs-comment\">\/* Credit card number's pseudo element that'll overlay the number *\/<\/span>\n<span class=\"hljs-selector-id\">#number<\/span><span class=\"hljs-selector-pseudo\">::after<\/span> {\n  <span class=\"hljs-comment\">\/* Initializes the CSS counter named 'n' to the value 4 *\/<\/span>\n  <span class=\"hljs-attribute\">counter-set<\/span>: n <span class=\"hljs-number\">4<\/span>;\n  <span class=\"hljs-comment\">\/* Displays the counter value three times, \n     formatted as dots (symbols), separated by spaces *\/<\/span>\n  <span class=\"hljs-attribute\">content<\/span>: <span class=\"hljs-built_in\">counter<\/span>(n, dot) <span class=\"hljs-string\">\" \"<\/span> <span class=\"hljs-built_in\">counter<\/span>(n, dot) <span class=\"hljs-string\">\" \"<\/span> <span class=\"hljs-built_in\">counter<\/span>(n, dot);\n}<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<div class=\"wp-block-cp-codepen-gutenberg-embed-block cp_embed_wrapper\"><iframe id=\"cp_embed_emBEYaa\" src=\"\/\/codepen.io\/anon\/embed\/emBEYaa?height=450&amp;theme-id=1&amp;slug-hash=emBEYaa&amp;default-tab=result\" height=\"450\" scrolling=\"no\" frameborder=\"0\" allowfullscreen allowpaymentrequest name=\"CodePen Embed emBEYaa\" title=\"CodePen Embed emBEYaa\" class=\"cp_embed_iframe\" style=\"width:100%;overflow:hidden\">CodePen Embed Fallback<\/iframe><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">A counter of value 4 turns into four dots, as defined by the&nbsp;<code>dot<\/code>&nbsp;counter style. The converted counter value is shown three times with a space in between to cover the first 12 digits of the credit card number.<\/p>\n\n\n\n<p class=\"learn-more wp-block-paragraph\">When using non-monospace fonts, adjust letter spacing to evenly distribute dots over numbers. Monospace fonts ensure all characters are of equal width.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Method 2: Pad Value<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Remember, I mentioned earlier that&nbsp;<code>@counter-style<\/code>&nbsp;has a long list of descriptors? One of them is&nbsp;<code>pad<\/code>. It sets a minimum length for the generated characters. If the sequence is shorter, the pad characters fill the remaining space. This is often used to convert list numbering like 1, 2, 3 to 01, 02, 03.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We can also use this to create our sequence.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-7\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css\"><span class=\"hljs-keyword\">@counter-style<\/span> ast {\n  <span class=\"hljs-selector-tag\">symbols<\/span>: '';\n  <span class=\"hljs-selector-tag\">pad<\/span>: 4 '\\002<span class=\"hljs-selector-tag\">A<\/span>';\n}\n<span class=\"hljs-selector-id\">#number<\/span><span class=\"hljs-selector-pseudo\">::after<\/span> {\n  <span class=\"hljs-attribute\">counter-set<\/span>: n <span class=\"hljs-number\">1<\/span>;\n  <span class=\"hljs-attribute\">content<\/span>: <span class=\"hljs-built_in\">counter<\/span>(n, ast) <span class=\"hljs-string\">\" \"<\/span> <span class=\"hljs-built_in\">counter<\/span>(n, ast) <span class=\"hljs-string\">\" \"<\/span> <span class=\"hljs-built_in\">counter<\/span>(n, ast);\n}\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-7\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p class=\"wp-block-paragraph\">In this example,&nbsp;<code>symbols<\/code>&nbsp;is empty. Instead, the character (asterisk) is provided in the&nbsp;<code>pad<\/code>&nbsp;descriptor that ensures the length is 4. This way, the counter style produces four asterisks.<\/p>\n\n\n\n<div class=\"wp-block-cp-codepen-gutenberg-embed-block cp_embed_wrapper\"><iframe id=\"cp_embed_OPbjJez\" src=\"\/\/codepen.io\/anon\/embed\/OPbjJez?height=450&amp;theme-id=1&amp;slug-hash=OPbjJez&amp;default-tab=result\" height=\"450\" scrolling=\"no\" frameborder=\"0\" allowfullscreen allowpaymentrequest name=\"CodePen Embed OPbjJez\" title=\"CodePen Embed OPbjJez\" class=\"cp_embed_iframe\" style=\"width:100%;overflow:hidden\">CodePen Embed Fallback<\/iframe><\/div>\n\n\n\n<p class=\"learn-more wp-block-paragraph\">You can also experiment with the descriptors&nbsp;<code>suffix<\/code>&nbsp;and&nbsp;<code>prefix<\/code>&nbsp;to build sequences.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The number of overlaying characters doesn\u2019t always need to match the number of hidden characters. In the example shown at the beginning of the article, there\u2019s a sequence of long dashes covering the amount.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">A Sequence of Mixed Characters<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">We can also mix characters using positional algorithms:&nbsp;<code>alphabetic<\/code>&nbsp;and&nbsp;<code>numeric<\/code>. These systems can compound the&nbsp;<code>symbols<\/code>&nbsp;(characters) and create sequences like 231, BCA, etc. The&nbsp;<code>additive<\/code>&nbsp;system does something a little similar, but we\u2019ll explore that later.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The <code>numeric<\/code>\u00a0value uses a standard\u00a0<a href=\"https:\/\/en.wikipedia.org\/wiki\/Positional_notation\">positional notation<\/a>, while\u00a0<code>alphabetic<\/code>\u00a0uses a\u00a0<a href=\"https:\/\/en.wikipedia.org\/wiki\/Bijective_numeration\">bijective<\/a>\u00a0positional notation where there\u2019s no value for 0.<\/p>\n\n\n\n<p class=\"learn-more wp-block-paragraph\">A positional notation system is a method of representing numbers where the value of a digit is determined by its physical position or slot within the string.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-8\" data-shcb-language-name=\"HTML, XML\" data-shcb-language-slug=\"xml\"><span><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">li<\/span> <span class=\"hljs-attr\">value<\/span>=<span class=\"hljs-string\">\"0\"<\/span>&gt;<\/span>zero<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">li<\/span>&gt;<\/span>\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">li<\/span>&gt;<\/span>one<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">li<\/span>&gt;<\/span>\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">li<\/span>&gt;<\/span>two<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">li<\/span>&gt;<\/span>\n<span class=\"hljs-comment\">&lt;!-- more items --&gt;<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-8\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">HTML, XML<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">xml<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-9\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css\"><span class=\"hljs-keyword\">@counter-style<\/span> symbolic-loop { \n  <span class=\"hljs-comment\">\/* system: symbolic; is the default *\/<\/span>\n  <span class=\"hljs-selector-tag\">symbols<\/span>: <span class=\"hljs-selector-tag\">A<\/span> <span class=\"hljs-selector-tag\">B<\/span> <span class=\"hljs-selector-tag\">C<\/span>; \n  <span class=\"hljs-selector-tag\">suffix<\/span>: \" \";\n}\n<span class=\"hljs-keyword\">@counter-style<\/span> numeric-loop { \n  <span class=\"hljs-selector-tag\">system<\/span>: <span class=\"hljs-selector-tag\">numeric<\/span>; \n  <span class=\"hljs-selector-tag\">symbols<\/span>: <span class=\"hljs-selector-tag\">A<\/span> <span class=\"hljs-selector-tag\">B<\/span> <span class=\"hljs-selector-tag\">C<\/span>; \n  <span class=\"hljs-selector-tag\">suffix<\/span>: \" \";\n}\n<span class=\"hljs-keyword\">@counter-style<\/span> alphabetic-loop { \n  <span class=\"hljs-selector-tag\">system<\/span>: <span class=\"hljs-selector-tag\">alphabetic<\/span>; \n  <span class=\"hljs-selector-tag\">symbols<\/span>: <span class=\"hljs-selector-tag\">A<\/span> <span class=\"hljs-selector-tag\">B<\/span> <span class=\"hljs-selector-tag\">C<\/span>; \n  <span class=\"hljs-selector-tag\">suffix<\/span>: \" \";\n}<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-9\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<div class=\"wp-block-cp-codepen-gutenberg-embed-block cp_embed_wrapper\"><iframe id=\"cp_embed_EaNvxqx\" src=\"\/\/codepen.io\/anon\/embed\/EaNvxqx?height=500&amp;theme-id=1&amp;slug-hash=EaNvxqx&amp;default-tab=result\" height=\"500\" scrolling=\"no\" frameborder=\"0\" allowfullscreen allowpaymentrequest name=\"CodePen Embed EaNvxqx\" title=\"CodePen Embed EaNvxqx\" class=\"cp_embed_iframe\" style=\"width:100%;overflow:hidden\">CodePen Embed Fallback<\/iframe><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Although specific sequences can be manually written, you can use an online base converter to find their decimal value and use counter style to create it. For instance, I want to hide a 7-digit pin code using the sequence XXYYZZX. Here\u2019s how it\u2019s done with&nbsp;<code>alphabetic<\/code>:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-10\" data-shcb-language-name=\"HTML, XML\" data-shcb-language-slug=\"xml\"><span><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span> <span class=\"hljs-attr\">id<\/span>=<span class=\"hljs-string\">\"pin\"<\/span>&gt;<\/span>\n  SW1A1AA\n<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-10\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">HTML, XML<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">xml<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-11\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css\"><span class=\"hljs-keyword\">@counter-style<\/span> alphabetic-system {\n  <span class=\"hljs-selector-tag\">system<\/span>: <span class=\"hljs-selector-tag\">alphabetic<\/span>;\n  <span class=\"hljs-selector-tag\">symbols<\/span>: <span class=\"hljs-selector-tag\">X<\/span> <span class=\"hljs-selector-tag\">Y<\/span> <span class=\"hljs-selector-tag\">Z<\/span>;\n}\n<span class=\"hljs-selector-id\">#pin<\/span><span class=\"hljs-selector-pseudo\">::after<\/span> {\n  <span class=\"hljs-attribute\">counter-set<\/span>: n <span class=\"hljs-number\">1225<\/span>;\n  <span class=\"hljs-attribute\">content<\/span>: <span class=\"hljs-built_in\">counter<\/span>(n, alphabetic-system );\n}<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-11\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<pre class=\"wp-block-preformatted\">In the alphabetic system:<br>X=1, Y=2, Z=3<br><br>To get the sequence XXYYZZX, we convert its base 3 (there are 3 characters) bijective notation to base 10 (decimal) notation. <br><br>Base 3 bijjective is 1122331 (XXYYZZX)<br><br>1 * 3^6 = 729<br>1 * 3^5 = 243<br>2 * 3^4 = 162<br>2 * 3^3 = 54<br>3 * 3^2 = 27<br>3 * 3^1 = 9<br>1 * 3^0 = 1<br><br>Adding these values together, we get 1225 in base 10.<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/baseconvert.com\/?bijective-3=1122331&amp;decimal\">Here&#8217;s the online calculation for this.<\/a><\/p>\n\n\n\n<div class=\"wp-block-cp-codepen-gutenberg-embed-block cp_embed_wrapper\"><iframe id=\"cp_embed_raWzNXE\" src=\"\/\/codepen.io\/anon\/embed\/raWzNXE?height=450&amp;theme-id=1&amp;slug-hash=raWzNXE&amp;default-tab=result\" height=\"450\" scrolling=\"no\" frameborder=\"0\" allowfullscreen allowpaymentrequest name=\"CodePen Embed raWzNXE\" title=\"CodePen Embed raWzNXE\" class=\"cp_embed_iframe\" style=\"width:100%;overflow:hidden\">CodePen Embed Fallback<\/iframe><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">These techniques are particularly useful for generating pseudo-random text, which will be covered in the next article. In the next article (coming soon!), we\u2019ll also explore how to use the\u00a0<code>cyclic<\/code>\u00a0algorithm to create a word rotator and delve into the\u00a0<code>additive<\/code>\u00a0algorithm.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>@counter-style is useful for replacing the ::marker of lists easily, but it controls any markers-of-counters, so we can use it for more.<\/p>\n","protected":false},"author":20,"featured_media":9908,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"sig_custom_text":"","sig_image_type":"featured-image","sig_custom_image":0,"sig_is_disabled":false,"inline_featured_image":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[492,7],"class_list":["post-9889","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog-post","tag-counter-style","tag-css"],"acf":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2026\/06\/obfuscate.jpg?fit=1600%2C910&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts\/9889","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/users\/20"}],"replies":[{"embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/comments?post=9889"}],"version-history":[{"count":6,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts\/9889\/revisions"}],"predecessor-version":[{"id":9910,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts\/9889\/revisions\/9910"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/media\/9908"}],"wp:attachment":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/media?parent=9889"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/categories?post=9889"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/tags?post=9889"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}