week4.md - Yongsin0/wp109b GitHub Wiki

  • Pseudo already defined.

Pseudo-class

syntax:
selector:pseudo-class {
  property: value;
}

example:
a:link {
  color: #FF0000;
}

a:visited {
  color: #00FF00;
}

a:hover {
  color: #FF00FF;
}

a:active {
  color: #0000FF;
}

偽元素

CSS 偽元素用於為元素的指定部分設置樣式
syntax:
selector::pseudo-element {
  property: value;
}

example:
p::first-line {
  color: #ff0000;
  font-variant: small-caps;
}

Combinators

 * descendant selector (space)
 * child selector (>)
 * adjacent sibling selector (+)
 * general sibling selector (~)