/css-target-attribute.css Secret
Last active
December 19, 2022 20:03
Star
You must be signed in to star a gist
CSS Target Attribute
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Select elements with a specified attribute and value. */ | |
a[target="_blank"] { | |
color: red; | |
} | |
/* Select elements with an attribute value containing a specified WORD. */ | |
svg[title~="flower"] { | |
border: 5px solid yellow; | |
} | |
/* Select elements with the specified attribute, whose value can be exactly the specified value, or the specified value followed by a hyphen (-). */ | |
h2[class|="top"] { | |
background: yellow; | |
} | |
/* Select elements with the specified attribute, whose value STARTS with the specified value. */ | |
[class^="top"] { | |
background: yellow; | |
} | |
/* Select elements whose attribute value ENDS with a specified value. */ | |
[class$="test"] { | |
background: yellow; | |
} | |
/* Select elements whose attribute value contains a specified value, which does NOT have to be a whole word. */ | |
[class*="te"] { | |
background: yellow; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment