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

New Rule: no-px font sizing #73

Open
1 task
nasty23-star opened this issue Feb 26, 2025 · 2 comments
Open
1 task

New Rule: no-px font sizing #73

nasty23-star opened this issue Feb 26, 2025 · 2 comments
Labels
enhancement New feature or request

Comments

@nasty23-star
Copy link

Environment

Rule details
Flag the use of px

What type of rule is this?
Warns about a potential problem

Example code
.card {
font-size: 12px;
}

Participation

I am willing to submit a pull request to implement this rule.
Additional comments
Needing !important indicates there may be a larger underlying issue.

What problem do you want to solve?

Rem and em are more accessibility-friendly than px.

What do you think is the correct solution?

The option to enable accessibility mode and warn about usage of px.

Participation

  • I am willing to submit a pull request for this change.

Additional comments

I think it's very useful for improving accessibility.
https://www.a11y-collective.com/blog/what-is-rem-in-css/

@nasty23-star nasty23-star added the enhancement New feature or request label Feb 26, 2025
@nzakas
Copy link
Member

nzakas commented Feb 26, 2025

Thanks for the suggestion. This seems a bit too specific to be included as a general rule. (We typically don't create rules that simply disallow specific syntax.)

I think we'd be open to a rule that was a bit broader, maybe something that encouraged the use of specific font size types? So rather than just disallowing px, maybe it would look for a small set of "good" size types?

@nzakas nzakas added this to Triage Feb 26, 2025
@github-project-automation github-project-automation bot moved this to Needs Triage in Triage Feb 26, 2025
@nzakas nzakas moved this from Needs Triage to Triaging in Triage Feb 26, 2025
@nasty23-star
Copy link
Author

Thank you for the clarification. Your suggestion sounds very good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Triaging
Development

No branches or pull requests

2 participants