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

fix breaking centered text-alignment for td, th #400

Merged
merged 2 commits into from
Sep 20, 2023

Conversation

kalligator
Copy link
Contributor

I noticed that :where(td,th) has text-align: left set, which messes things up when td or th has align="center" in their html tag.

I fixed this issue, but I think it would be better to remove the alignment from :where(td,th) altogether, because it might also cause problems for right-to-left users.

I noticed that :where(td,th) has text-align: left set, which messes things up when td or th has align="center" in their html tag. 

I fixed this issue, but I think it would be better to remove the alignment from :where(td,th) altogether, because it might also cause problems for right-to-left users.
@stackblitz
Copy link

stackblitz bot commented Sep 1, 2023

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@argyleink
Copy link
Owner

Thank you for filing this 🙂

I'm surprised I committed a physical property for text alignment, I assumed I would have committed text-align: start.

What if we did this:

:where(td:not([align]), th:not([align])) {
  text-align: start;
}

this way

  • start is always the default alignment (wont break for right to left users)
  • will only apply if the align attribute is absent from the cell
  • the :not() is within the :where() as to not increase specificity and be easy to override

@kalligator
Copy link
Contributor Author

That sounds a lot better indeed!

@argyleink argyleink merged commit 1f1f55e into argyleink:main Sep 20, 2023
2 checks passed
@kalligator kalligator deleted the patch-1 branch September 20, 2023 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants