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

Add custom HTML attribute alongside the CSS variable #67

Open
hyvyys opened this issue Mar 24, 2021 · 0 comments
Open

Add custom HTML attribute alongside the CSS variable #67

hyvyys opened this issue Mar 24, 2021 · 0 comments

Comments

@hyvyys
Copy link

hyvyys commented Mar 24, 2021

CSS variables are one great way to style and animate split text, but it is difficult to use selectors like :nth-child because the plugin always splits words even when I use data-splitting="chars" and additionally the obnoxious whitespace nodes are inserted.

Adding a data attribute would allow to overcome this, e.g. instead of just this:

<span class="char" data-char="V" style="--char-index:12;">V</span>

we would have this

<span class="char" data-char="V" style="--char-index:12;" data-char-index="12">V</span>

This would allow for rules like below:

[data-char-index="12"] {
  //...
}
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

No branches or pull requests

1 participant