fast-michael

CSS provides a formula for determining a style’s specificity that’s based on a value assigned to the style’s selector—a tag selector, class selector, ID selector, and so on. Here’s how the system works:

 

  • A tag selector is worth 1 point.
  • A class selector is worth 10 points.
  • An ID selector is worth 100 points.
  • An inline style (page 39) is worth 1,000 points.

 

The bigger the number, the greater the specificity. So say you create the following three styles:

 

  • a tag style for the <img> tag ( specificity = 1)
  • a class style named .highlight (specificity = 10)
  • an ID style named #logo (specificity = 100)

分类:

技术点:

相关文章:

  • 2021-09-19
  • 2021-11-04
  • 2021-11-04
  • 2021-07-02
  • 2021-12-24
  • 2021-11-04
  • 2021-11-04
  • 2021-11-04
猜你喜欢
  • 2021-10-03
  • 2021-11-04
  • 2021-11-04
  • 2021-11-04
  • 2021-09-30
  • 2021-11-04
  • 2021-11-04
相关资源
相似解决方案