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

Metric CSS is a pain point #100

Closed
christianbundy opened this issue Jan 28, 2020 · 4 comments · Fixed by #411
Closed

Metric CSS is a pain point #100

christianbundy opened this issue Jan 28, 2020 · 4 comments · Fixed by #411
Assignees
Labels
bug Something isn't working
Milestone

Comments

@christianbundy
Copy link
Member

christianbundy commented Jan 28, 2020

What's the problem you want to solved? I thought the metric-derived CSS variables were cute and fun, but I tried to edit the CSS today and I couldn't remember whether to use --micro or --milli for half-size. Boo.

Is there a solution you'd like to recommend? Maybe we should just do:

:root {
  --three: calc(var(--one) * 3);
  --two: calc(var(--one) * 2);
  --one: 1rem;
  --half: calc(var(--base) / 2);
  --third: calc(var(--base) / 3);
  --quarter: calc(var(--base) / 4);
}

This has the nice side-effect of being able to easily change the base, so we could use 1.5rem or the golden ratio or whatever we want in the future without having to memorize quirky variables names. Simplicity!!!!!

@christianbundy christianbundy added the bug Something isn't working label Jan 28, 2020
@Powersource
Copy link
Collaborator

A convention I kind of like is to call it e.g. --size-1 --size-2 etc, makes it easy to switch between different ones and I think they're sorted when autocomplete in devtools suggests them. (:bike::house:)

@christianbundy christianbundy self-assigned this Feb 2, 2020
@georgeowell
Copy link
Collaborator

This is quite stale. Did you decide what to do yet?

@christianbundy
Copy link
Member Author

It's old, but it's still a problem that I'd like to resolve.

@christianbundy
Copy link
Member Author

cc: @nickwynja if you have any thoughts

christianbundy added a commit to christianbundy/oasis that referenced this issue Apr 14, 2020
Problem: The "metric CSS" was kind of clever but mostly just confusing.

Solution: Use `--size-N` for the size, where the size is `2^n`. Double
size is `--size-1`, half size is `--size--1` (negative one). The
negatives kind of suck but I couldn't think of a better solution that
didn't give up the flexibility, brevity, or the ability to sort
alphabetically.

Fixes: fraction#100
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging a pull request may close this issue.

3 participants