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

CSS icon accessibility #2

Open
cookiecrook opened this issue Oct 16, 2016 · 3 comments
Open

CSS icon accessibility #2

cookiecrook opened this issue Oct 16, 2016 · 3 comments

Comments

@cookiecrook
Copy link

Since these icons are not accessible by default, you could make them so through the CSS "alt" or older "-webkit-alt" from an older draft of CSS Generated Content Level 3 or 4, or the newer / syntax of the content property.(Commenting from mobile; hit back if you have trouble finding a link.)

.class::before {
    content: "" / "search"; /* alt text for gen content */
    alt: "search"; /* older syntax */
    -webkit-alt: "search"; /* legacy support */
}
@cookiecrook
Copy link
Author

You can use these with attr() too.

@wentin
Copy link
Owner

wentin commented Oct 16, 2016

Nice! I plan to add this soon. Just before pesedo element is often occupied, need to make sure it doesn't change the appearance of the icons.

@cookiecrook
Copy link
Author

cookiecrook commented Oct 17, 2016

alt and -webkit-alt won't change any visual display. If you are already using content you'd need to use the original property definition and then overwrite it with the newer syntax.

content: 'foo'; /* works for any browser */
content: 'foo' / 'alt'; /* redefines previous rule in newer browsers that recognize the new syntax; line ignored by older browsers. */

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

2 participants