Skip to content

Instantly share code, notes, and snippets.

@keidarcy
Created June 12, 2020 05:25
Show Gist options
  • Save keidarcy/f41893f8fde9de443d14fa527a344d2d to your computer and use it in GitHub Desktop.
Save keidarcy/f41893f8fde9de443d14fa527a344d2d to your computer and use it in GitHub Desktop.
CSS Pseudo

EXAMPLE

button:hover{
  color: purple;
}

button:focus{
  color: green;
}

button:disables{
  background: gray;
}

li:first-child {
  font-size: 3rem;
}

li:last-child {
  font-size: 3rem;
}

// first-of-type last-of-type

li:nth-child(2){
}

li:nth-child(odd | even) {
}

li:nth-child(3n) {
// 3rd, 6th, 9th
}

li:not(:hover) {
  text-decoration: line-through;
  color: orangered;
}

.dropdown:focus-within {}
<p lang="es">hola!</p>

p:lang(...) {}

p:lang(de):nth-of-type(3n){
  color:gold;
}

CSS Pseudo Element

  • ::Element(not class)
input::placeholder {
  color: hotpink
}
// or ::after ::before
// is an actual part of dom
  • :Class (current state)
input:focus {
}

EXAMPLE

p::first-letter {
  font-size:5rem;
}
li::before {
  content: "🤡";
}
::selection {
  background: black;
  color: red
}

::-WEBKIT-SCROLLBAR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment