Skip to content

Instantly share code, notes, and snippets.

@sandikodev
Created July 3, 2023 04:59
Show Gist options
  • Save sandikodev/f0776ae8ef440ba76af0a1f26829aec2 to your computer and use it in GitHub Desktop.
Save sandikodev/f0776ae8ef440ba76af0a1f26829aec2 to your computer and use it in GitHub Desktop.
css2 cheatsheet
## SELECTOR
### CSS2
/* Child Selector */
div > p {
color: red;
}
/* Adjacent Sibling Selector */
h1 + p {
margin-top: 20px;
}
/* Attribute Selector */
input[type="text"] {
width: 200px;
}
### CSS3
/* General Sibling Combinator */
h1 ~ p {
font-size: 1.2em;
}
/* :not() Pseudo-class */
div:not(.highlighted) {
opacity: 0.5;
}
/* Attribute Selectors */
a[href*="google"] {
background: url(/images/google-icon.png) no-repeat;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment