Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSS

css attribute selector

/* <a> elements with a title attribute */
a[title] {
  color: purple;
}
/* <a> elements with an href matching "https://example.org" */
a[href="https://example.org"]
{
  color: green;
}
/* <a> elements with an href containing "example" */
a[href*="example"] {
  font-size: 2em;
}
/* <a> elements with an href ending ".org" */
a[href$=".org"] {
  font-style: italic;
}
/* <a> elements whose class attribute contains the word "logo" */
a[class~="logo"] {
  padding: 2px;
}
Source by lw-2022.netlify.app #
 
PREVIOUS NEXT
Tagged: #css #attribute #selector
ADD COMMENT
Topic
Name
9+6 =