Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 124661
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T05:02:09+00:00 2026-05-11T05:02:09+00:00

Say you have a CSS 2.1 counter like ol { counter-reset: section; list-style-type: none;

  • 0

Say you have a CSS 2.1 counter like

ol {   counter-reset: section;   list-style-type: none; } li:before {   counter-increment: section;   content: counters(section, '.') ' '; }   <ol>   <li>itemA</li>          <!-- 1     -->   <li>itemB               <!-- 2     -->     <ol>       <li>itemC</li>      <!-- 2.1   -->       <li id='foo'>itemD</li>      <!-- 2.2   --> 

(see https://developer.mozilla.org/en/CSS_Counters ‘nesting counters’)

Is there a way to read/get the :before.content (‘2.2’ in this case) for <li id='foo'> in JavaScript?

Edit: In my case a Mozilla-only solution would suffice. But there really seems to be no way to access this information. At least I didn’t find any at https://developer.mozilla.org/en/CSS_Counters ff.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T05:02:09+00:00Added an answer on May 11, 2026 at 5:02 am

    None that I can think of, no. :before pseudo-elements are not part of the DOM so there is no way to address their content.

    You could make a function that scanned the stylesheet’s DOM for the :before rules and worked out which rules the browser had applied where, but it would be incredibly messy.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say I have the following css: .cls {} .cls ul {list-style-type:none;} .cls ul li
Lets say I have some markup like this: <html> <head> <style type=text/css> #container {
I have css like this: .done {list-style-image:url('images/tick.gif')} .notdone {list-style-image:url('images/cross.gif')} And html like this: <ul>
Say I have the following code <style type=text/css media=all> span, ul, ul li {
Say I have a list as follows: item1 item2 item3 Is there a CSS
Say I have a something like this: <p id=script>$(p).css(color, red);</p> Is there a way
Let's say I have a CSS class named foo but would like it to
Let's say we have a massive CSS file that is used to style the
say I have layout like so: <div id=main> <div id=NormalContent> {some content which is
Say I have a class name person with foll style in css- .person {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.