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

[fill-stroke-3] Should % stroke widths be relative to the viewport for CSS? #6116

Open
smfr opened this issue Mar 18, 2021 · 5 comments
Open

Comments

@smfr
Copy link
Contributor

smfr commented Mar 18, 2021

fill-stroke-3 says that stroke-width is relative to scaled viewport size without a normative reference for what that means in CSS.

Perhaps, if we want to use viewport size, it should use the same dimensions that are used for viewport units?

Alternatively, perhaps in CSS % in stroke-width should be relative to something else?

@fantasai
Copy link
Collaborator

Added note: smfr suggested making it relative to font-size (as we're doing in letter-spacing etc.) since that might actually be useful.

@tabatkins
Copy link
Member

Note that "in CSS" isn't the discriminator here; SVG already defines what %s mean in CSS (and you can't use %s in the attributes anyway).

We could have a different definition for it in non-SVG elements, or we could just try and change the definition wholesale (since % sizing on stroke-width properties is probably rarely-used?).

@astearns astearns added this to the APAC VF2F-2021-04-08 milestone Apr 2, 2021
@css-meeting-bot
Copy link
Member

css-meeting-bot commented Apr 8, 2021

The CSS Working Group just discussed [fill-stroke-3] Should % stroke widths be relative to the viewport for CSS?, and agreed to the following:

  • RESOLVED: CSS stroke-width on text will resolve percentages against computed font-size
The full IRC log of that discussion <Rossen_> Topic: [fill-stroke-3] Should % stroke widths be relative to the viewport for CSS?
<Rossen_> github: https://github.com//issues/6116
<dlibby_> smfr: noticed that % stroke-width are relative to viewport, this seems unexpected that it would change when resize window
<dlibby_> smfr: i would expect it to map to line-height or something more local
<dlibby_> Rossen_: didn't we have something in the SVG spec that was disambiguating properties that derive from SVG viewport, what happens in CSS
<dlibby_> smfr: i don't recall
<miriam> q+
<dlibby_> heycam: transform-box has all the keywords and how they map in non-SVG contexts. we can probably use the same mapping
<dlibby_> Rossen_: in most cases resolving to containing box
<dlibby_> heycam: that's right
<dlibby_> Rossen_: may or may not be expected here
<fantasai> heycam, https://www.w3.org/TR/css-box-3/#keywords ?
<dlibby_> smfr: context: filed when noticing some odd webkit code, not high priority
<heycam> fantasai: that's it
<dlibby_> Rossen_: I'd like to align behaviors that is coming from SVG, and how to map the concepts when they come to CSS
<heycam> so 'border-box' according to that definition
<dlibby_> Rossen_: continue to use the escape hatch for weirdness in the future
<Rossen_> ack miriam
<dlibby_> miriam: consistent translation from SVG makes sense. i associated with text-decoration-thickness which resolves against em
<dlibby_> fantasai: there's not a good reason for text stroke width to reference contaning box, but resolving against font metrics makes sense, and we should do what is useful if there are no webcompat concerns
<Rossen_> ack fantasai
<dlibby_> fantasai: re: diverging from SVG behavior, would be beneficial for conceptual clarity rather than trying to stay consistent in an unclear manner
<dlibby_> fantasai: not sure if %'s on stroke-width on text in SVG is common, maybe we can switch SVG as well?
<heycam> q+
<dlibby_> fantasai: more compat concerns but can't imagine that authors were intentionally using is as it is currently spec'd
<dlibby_> Rossen_: worth getting data
<dlibby_> fantasai: agreed for SVG, we should probably just do it for CSS
<dlibby_> heycam: you can use stroke-width on non-text
<Rossen_> ack heycam
<dlibby_> heycam: hopefully we can do it across SVG
<dlibby_> fantasai: might be more risk, not sure we can change all the behavior
<dlibby_> fantasai: we should have percentages resolve against 'em' since it provides a pixel value
<fantasai> s/'em' since it provides a pixel value/'font-size', and inherit as a percentage, as it does for text decoration/
<dlibby_> Rossen_: proposed resolution - for CSS stroke-width on text will resolve percentages against 'em' size
<fantasai> s/em/computed font-size/
<dlibby_> RESOLVED: CSS stroke-width on text will resolve percentages against 'em' size

@fantasai
Copy link
Collaborator

fantasai commented Apr 8, 2021

We also decided to investigate whether this can be extended to SVG. Marking Needs Data for that.

@emilio
Copy link
Collaborator

emilio commented Apr 8, 2021

@astearns astearns removed this from the APAC VF2F-2021-04-08 milestone Jul 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants