Home  >  Article  >  Web Front-end  >  A question about CSS selector priority_html/css_WEB-ITnose

A question about CSS selector priority_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:02:46804browse

<span style="font-size:14px;"><html>  <head>    <style type="text/css">        #redP p {             /* 权值 = 100+1=101 */             color:#F00;  /* 红色 */        }         #redP .red em {             /* 权值 = 100+10+1=111 */             color:#00F; /* 蓝色 */         }         #redP p span em {             /* 权值 = 100+1+1+1=103 */             color:#FF0;/*黄色*/        }    </style>  </head>  <body>     <div id="redP">        <p class="red">red           <span><em>em red</em></span>        </p>        <p>red</p>     </div>  </body></html></span>

Click to see if the effect is what you want
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn