I'm struggling with the CSS counter mechanism(s)

In summary, the conversation is about the struggle with using CSS counters to create a continuous numbering for an ordered list. The person is seeking help in figuring out why the numbering is showing twice in each table cell and why the CSS is creating different numbering rather than modifying the default numbering of unordered lists. The conversation includes links to the HTML and CSS syntax used. A helpful tutorial is also mentioned.
  • #1
s3a
818
8

Homework Statement


There's a visual representation of what I am aiming for, in Question 1's Figure 2.:
https://www.docdroid.net/P6VZNB1/soe...df.html#page=3

Homework Equations


https://www.w3schools.com/CSSref/pr_gen_counter-increment.asp

The Attempt at a Solution


Hello to everyone who's reading this.
icon_smile.gif


I looked at various websites, including several YouTube videos, but still I'm really struggling with CSS counter stuff. Basically, all I am trying to do is to make the numbering of an ordered list continue when the ordered list goes from row n to row n+1.

The following is my HTML syntax.:
http://pastebin.com/hw8rmUWB

The following is my CSS syntax, where the last three selectors are what I'm struggling with (as indicated by the comment).:
http://pastebin.com/cYFynxAs

Could someone please help me figure out why the numbering is showing twice in each table cell (despite the CSS incrementation seemingly working semi-correctly)? It seems like the CSS is creating some different numbering, rather than modifying the default numbering of unordered lists.

Any help in figuring out why what I am trying to accomplish is not working would be GREATLY appreciated!
 
Last edited by a moderator:
Physics news on Phys.org

FAQ: I'm struggling with the CSS counter mechanism(s)

What is the CSS counter mechanism?

The CSS counter mechanism is a feature that allows you to create and use counters in your CSS code. It can be used to automatically number and label elements on a webpage.

How do I use the CSS counter mechanism?

To use the CSS counter mechanism, you first need to define a counter using the counter-reset property. Then, you can use the counter-increment property to increment the counter and the content property to display the counter value on your webpage.

What is the difference between counter-reset and counter-increment?

The counter-reset property is used to define a new counter or reset an existing counter to a specific value. The counter-increment property, on the other hand, is used to increment the value of an existing counter by a specified amount.

Can I use the CSS counter mechanism on any element?

Yes, you can use the CSS counter mechanism on any element, as long as it has a content property. This includes elements such as h1, p, span, and div.

Is the CSS counter mechanism supported by all browsers?

Yes, the CSS counter mechanism is supported by all modern browsers, including Chrome, Firefox, Safari, and Edge. However, some older browsers may not support it, so it is important to provide a fallback option for those users.

Similar threads

Back
Top