One can easily include CSS content within the div element

Below is the CSS code used to create counters:

#lctndrp li:before{
   content: counters(item, ".") " ";
   counter-increment: item;
}

The HTML code is as follows:

<ol>
  <li>
    ::before 
    one
    <ol>
      <li>
        ::before
        one.one
      </li>
      <li>
        ::before
        one.two
      </li>
    </ol>
  </li>
  <li>
    ::before
    two
    <ol>
      <li>
        ::before
        two.one
      </li>
      <li>
        ::before
        two.two
      </li>
    </ol>
  </li>
</ol>

The desired HTML output should be:

<ol>
  <li>
    <div>1</div>
    <ol>
      <li>
        <div>1.1</div>
      </li>
      <li>
        <div>1.2</div>
      </li>
    </ol>
  </li>
  <li>
    <div>2</div>
    <ol>
      <li>
        <div>2.1</div>
      </li>
      <li>
        <div>2.2</div>
      </li>
    </ol>
  </li>
</ol>

I have successfully created a counter using CSS for the list items with format 1, 1.1, 1.2 within the li:before tag. Now I am looking to achieve the same result within the div tag. Can you help me find a solution to this issue?

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What are the best ways to engage with a div element using keyboard shortcuts?

Is it possible to enable keyboard shortcuts for interacting with div elements? I am working on a project tailored for seniors who may have difficulty using a mouse. Is there a way to utilize keyboard shortcuts to click on divs and access their contents? H ...

Modifying the border hue of Material-UI's Select Component

Here is the Select component I've created using materials-UI <FormControl variant="outlined"> <Select value={this.state.value} onChange = {this.handleChange} className={this.props.classes.select} inputProps = {{class ...

Utilizing jQuery in Wordpress to Toggle Content Visibility

Currently, my website pulls the 12 most recent posts from a specific category and displays them as links with the post thumbnail image as the link image. To see an example in action, visit What I am aiming to achieve is to enhance the functionality of my ...

Toggle css comment line using gulp

Is it possible to temporarily deactivate a particular CSS comment on a specific line using Gulp and then reactivate it after completing a build task? As an illustration, I am interested in deactivating the @import 'compass/reset'; statement loca ...

Tips for choosing a drop-down menu option without an identifier using Selenium in Python

I am trying to choose an element/item from a drop-down menu in Python and Selenium without using an id element. Here is the HTML code snippet: <mbo-transaction-mode-select mode="filters.mode" class="ng-isolate-scope"> <select class="form-con ...

What is the proper way to align text based on the text above using CSS?

I have a container with a width of 50% of the viewport width, which contains some text. I want to align some other text below it to the right side. You can find an example here: https://jsfiddle.net/hadr4ytt/1/ Here is the current CSS for this: .containe ...

Exploring the Possibilities of Personalizing Data Tables

I have a unique requirement that I need help with: 1. On the mobile site, only 5 records should load by default with paginated data for subsequent pages. and 2. In desktop view, the default should be 10 records loaded with paginated data for subsequent ...

Positioning a div with a set size to the right while allowing a div with a variable width to the left

Even though I achieved the desired outcome in this example (http://jsfiddle.net/jcx3X/40/), I am intrigued by the reasons why this other scenario (http://jsfiddle.net/jcx3X/41/) does not work. What is the significance of the div being floated first in th ...

Occasional issue with the drop down menu not appearing correctly

I'm experiencing some difficulties with displaying a dropdown menu. Check out the fiddler link for reference: http://jsfiddle.net/GxrSk/ Below is the simplified HTML code: <nav> <ul id="top-menu"> <li class="parent"> ...

CKEditor applying spacing between <p> elements in source HTML

Working on a nodejs project with express and mongodb, I have a function that generates HTML code for saving it in the database. Here is an example: botcfg.body = '<h3>Trade amount settings</h3>' + '<p># Coin positi ...

Tips for displaying or hiding div elements

Currently, my task involves finding a way to display and conceal 4 divs individually. The links to these divs can be found in another nested div. Below is the code I am working with: <div id="container"> <div class="roundbox"> < ...

Ways to stop a JS plugin affecting HTML anchors and preventing them from automatically scrolling to the top

My friend is working on a website and he's using a plugin called Flip Lightbox. The basic functionality of the plugin is that when you click on an image, it flips over and pops out as a lightbox. Everything works fine, however, if you scroll down the ...

Safari is displaying the HTML5 range element improperly

My HTML input type=range element is styled perfectly in Chrome, but it's a disaster in Safari. The track ball disappears or only partially renders when moved, and it seems to take forever to load. Any idea what could be causing this strange behavior? ...

Bootstrap seems to be struggling with recognizing the last child of a button group. What steps can I take to troubleshoot and resolve this

I'm facing a small but annoying issue with my button group. The last button in the group appears rectangular instead of having rounded corners at the top right and bottom right. This is because the a.btn element is followed by a modal within the btn-g ...

Retrieve the content of a different page and store it as a variable using ajax

Is it possible to assign the content of another HTML page to a JavaScript variable? I attempted: var X = $(http://www.website.com/home).html() Unfortunately, this did not work, even though it seemed like a good idea. Can anyone provide guidance on how t ...

Translate CSS into JavaScript while maintaining selector understanding

I am interested in developing a tool that can read a .css file and generate a function that will accept an array of class names as input and output the corresponding styles for an element with those classes, represented as a JavaScript object. This tool wo ...

Ways to repair a website iframe malfunction

Whenever I visit this specific URL : (note: using an Ad-blocker is recommended) The link to the webpage loads properly, with no issues. However, attempting to load the same page through an iframe in my HTML code triggers an error: Here is my HTML code : ...

How to access a PHP include using data retrieved from a MySQL database?

I am currently in the process of developing a website that will be powered by a MySQL database. To simplify the structure of the URLs, I have decided to rewrite them to point to a single file. The file's layout is as follows: <html> <head&g ...

What is the reason for the columns being divided on the xs-viewport in Bootstrap?

Attempting to grasp the concepts of Bootstrap has left me puzzled, as I cannot comprehend why the col-xs-11 is not aligning correctly with the col-xs-1. Despite having a total of 12 columns, the layout seems off. CSS: [class^="col-"] { height: 20px; ...

Optimize your bootstrap carousel for mobile viewing by ensuring that the image and text are

My bootstrap carousel is displaying perfectly on desktop screens with images sized at 1200x400. However, when viewed on mobile devices, the images shrink so much that the text on them becomes unreadable. Additionally, the navigation dots at the bottom of t ...