CSS basic tutorial priority

CSS Priority


##Priority of a single selector Level

Inline style> id selector> class selector> tag selector

    php.cn  

习近平心中的互联网

##Use firebug observation:

26.png



##Priority of multiple selectors

The priority of multiple selectors. Generally, the more accurate the pointing, the higher the priority.

In special cases, we need to assume some values:

Tag selector priority is 1
  • ##Class selector The priority is 10

  • Id selector The priority is 100

  • Inline style The priority is 1000

  • Calculate the following priorities

.news h1{color:red;} Priority: 10 + 1 = 11.title{color:blue;} Priority: 10

div.news h1{color:red;} Priority: 1 + 10 + 1 = 12

h1.title{color:blue;} Priority: 1 + 10 = 11

Continuing Learning
||
php.cn

习近平心中的互联网

submit Reset Code
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!