-
Notifications
You must be signed in to change notification settings - Fork 683
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
[css-lists] How to control the gap between the marker and the text? #4571
Comments
I guess there's the possibility of ::marker {
content: counter(list-item) " ";
} where you choose the number of spaces depending on the desired gap. For more precision, maybe you can use a tabulator and control its size with .list-item { tab-size: 10px }
::marker { content: counter(list-item) "\9 " } If |
@Loirooriol What if I want to use the default disc marker?
Is there an issue for that? I couldn't find any, but it sounds like what I'm looking for. I imagine the UA stylesheets would need to have something like |
Theoretically the disc is just a U+2022 character, though in practice browsers just paint a circle without looking at the font. So you won't achieve the same result, but you can e.g. use
Currently there is no margin, the gap is caused by a space character in the suffix. Once Also note that it's not exactly So there may be some value in reintroducing something like |
@Loirooriol I think this is the document that lacks explanation on the gap: https://www.w3.org/TR/css-pseudo-4/#marker-pseudo It mentions marker::postfix as a possibility, but doesn't specify the issue. Anyway, the issue disappears if you set marker to something different from the defaults. Then, you can use In addition, even |
Ok, reading further, CSS Counter styles 3 tells the following about the predefined symbolic markers (6.3):
There's no way to override the suffix in any way. You can only create your own counter style fragment and set the list-style-type to it. But, if you compare the predefined counter styles, e.g. disc, you'll notice that implementation is not exactly the same. The gap is not the same and the size is different. All tests pass, and there is only one test for symbolic counter styles, And the tests themselves are invalid. they use I think the test should be modified and extended:
|
Ok, reading further, disc, square and circle (and other value names) are invalid for the |
Further digging, this commit made predefined counter-styles not overridable: So there were tests that checked the ability to override user-agent's The corresponding decision is captured here: So, to summarise. The decision was to accept the reality of discrepancies between the browsers when rendering predefined markers. But you can define your own counter styles which could inherit from the conformant representation defined in the spec. Still, there's no recommended way to control the gap between the marker and the text, other than adding spaces to the suffix. Further specs might add |
Ordered vs unordered is just an HTML concept, CSS doesn't care about that.
Not in Blink.
I implemented it in Blink. AFAIK only these are missing:
Yes https://drafts.csswg.org/css-counter-styles-3/#simple-symbolic: "a UA may instead render these styles using a UA-generated image or a UA-chosen font instead of rendering the specified character in the element’s own font"
That's because they are non-overridable counter-style names.
The above doesn't make the tests invalid.
I don't see how you reach this conclusion. Leaving some details up to the UAs doesn't make the entire thing useless. And you can always use your own counter style.
Well, yes, the suffix in a counter style, or the |
|
I might be missing something obvious, but I couldn't find a way to specify the gap between a list item's marker and its text after 15 minutes of Googling (or at least one that didn't involve a hack such as wrapping the text with a
<span style="position: relative; left: -5px;">
). I actually see that there used to be amarker-offset
property but it's been removed. Is something else coming, or is there a reason why this is missing?The text was updated successfully, but these errors were encountered: