Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Numbered list-groups with start attribute do not count correctly. #37345

Open
3 tasks done
petschki opened this issue Oct 20, 2022 · 7 comments
Open
3 tasks done

Numbered list-groups with start attribute do not count correctly. #37345

petschki opened this issue Oct 20, 2022 · 7 comments
Labels

Comments

@petschki
Copy link

petschki commented Oct 20, 2022

Prerequisites

Describe the issue

Numbered lists with a start attribute as offset do not count correctly. For example

<ol class="list-group list-group-numbered" start=10>
  <li class="list-group-item">ten</li>
  <li class="list-group-item">eleven</li>
</ol>

start counting from 1

Reduced test cases

A second value for counter-reset fixes the offset, but I do not know how to set this dynamically:

ol.list-group-numbered[start] {
  counter-reset:section 9;
}

What operating system(s) are you seeing the problem on?

Windows, macOS, Android, iOS, Linux

What browser(s) are you seeing the problem on?

Chrome, Safari, Firefox, Microsoft Edge, Opera

What version of Bootstrap are you using?

v5.2.2

@456535688765

This comment was marked as spam.

@mdo
Copy link
Member

mdo commented Oct 22, 2022

https://codepen.io/emdeoh/pen/WNyeNeQ works for me

@mdo mdo closed this as not planned Won't fix, can't repro, duplicate, stale Oct 22, 2022
@petschki
Copy link
Author

petschki commented Oct 23, 2022

Sorry, its not about <ol>s its about the CSS class .list-group-numbered which cannot have a offset right now. As long as its documented I'm ok with it.

@petschki
Copy link
Author

@mdo mdo reopened this Oct 23, 2022
@mdo
Copy link
Member

mdo commented Oct 23, 2022

Oh my bad! Reopening.

@nkdas91
Copy link
Contributor

nkdas91 commented Oct 25, 2022

My two cents! We can use CSS variables.

<ol start="10" class="list-group list-group-numbered" style="--list-start: 10;">
  <li class="list-group-item">list item</li>
  <li class="list-group-item">list item</li>
  <li class="list-group-item">list item</li>
  <li class="list-group-item">list item</li>
</ol>
.list-group-numbered {
  counter-reset: section var(--list-start, 0) !important;
}

https://codepen.io/nkdas91/pen/xxzxXjE

@matedon
Copy link

matedon commented Nov 14, 2023

My two cents! We can use CSS variables.

<ol start="10" class="list-group list-group-numbered" style="--list-start: 10;">
  <li class="list-group-item">list item</li>
  <li class="list-group-item">list item</li>
  <li class="list-group-item">list item</li>
  <li class="list-group-item">list item</li>
</ol>
.list-group-numbered {
  counter-reset: section var(--list-start, 0) !important;
}

https://codepen.io/nkdas91/pen/xxzxXjE

Ok. Your solution is a good idea but you need a -1.
Here you can see how: https://codepen.io/matedon/pen/LYqjJVm
.list-group-numbered { counter-reset: section calc(var(--list-start, 1) - 1) !important; }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants