• Home
  • About
    • Miles' Blog photo

      Miles' Blog

      Miles 用來記錄學習心得及筆記的地方。

    • Learn More
    • Email
    • Github
  • Posts
    • All Posts
    • All Tags
  • Projects

CSS - CSS Setup and Selectors

10 Mar 2018

Reading time ~1 minute

Reference : Codecademy - Learn CSS - CSS Setup and Selectors Class : description Tag : h5

.description h5 {
  color: teal;
}
  • Classes can be reusable, while IDs can only be used once.
  • IDs are more specific than classes, and classes are more specific than tags. That means IDs will override any styles from a class, and classes will override any styles from a tag selector.
  • The !important flag will override any style, however it should almost never be used, as it is extremely difficult to override.
  • Multiple unrelated selectors can receive the same styles by separating the selector names with commas.
    h5,p{
      color: rebeccapurple !important;
      font-family: Georgia;
    }
    


I.T.CSS Share Tweet +1