Skip to content

Instantly share code, notes, and snippets.

@libbyschuknight
Created March 21, 2019 04:44
Show Gist options
  • Save libbyschuknight/bb882114b1525a11421aa8fb8319e0a7 to your computer and use it in GitHub Desktop.
Save libbyschuknight/bb882114b1525a11421aa8fb8319e0a7 to your computer and use it in GitHub Desktop.
CSS attribute value
/* from https://css-tricks.com/almanac/selectors/a/attribute/ */
[data-value] {
/* Attribute exists */
}
[data-value="foo"] {
/* Attribute has this exact value */
}
[data-value*="foo"] {
/* Attribute value contains this value somewhere in it */
}
[data-value~="foo"] {
/* Attribute has this value in a space-separated list somewhere */
}
[data-value^="foo"] {
/* Attribute value starts with this */
}
[data-value|="foo"] {
/* Attribute value starts with this in a dash-separated list */
}
[data-value$="foo"] {
/* Attribute value ends with this */
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment