Home  >  Article  >  Web Front-end  >  Questions about repeated CSS definition_html/css_WEB-ITnose

Questions about repeated CSS definition_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:13:101312browse

If the styles for UL and LI have been defined in the external CSS file:



Then on the current page, I will define another style and apply it to the ff6d136ddc5fdfeffaf53ff6ee95f185 2725bc59dc72971ec020c7c0c6672165, is it invalid?


Reply to discussion (solution)

External css style and internal css style exist at the same time, and the internal css style shall prevail.
The internal css style and the style attribute of the tag exist at the same time, and the style of the style attribute shall prevail.

The situation you mentioned should be that both will be valid, but the CSS class has a higher priority. If the same style attribute exists, the style defined in the CSS class will override the ul li style.
CSS priority: http://spemoon.github.com/blog/2011/09/06/css-priority/

In the situation you mentioned, both should be valid, but CSS Classes have higher priority. If the same style attributes exist, the styles defined in the CSS class will override the ulli style.
CSS priority: http://spemoon.github.com/blog/2011/09/06/css-priority/

I define it in external CSS like this:

ul#navmenu li:hover li a,ul#navmenu li.iehover li a {  float: none;  background:#6699CC;   color:#FFFFFF;  border-bottom:#FFFFFF solid 1px;  text-align:left;   padding-left:10px;   width:180px; }ul#navmenu li:hover li a:hover,ul#navmenu li:hover li:hover a,ul#navmenu li.iehover li a:hover,ul#navmenu li.iehover li.iehover a {  background:#99CC00;   color:#FFFFFF;}


Define it again on the page:
<style>style2{    background:#000000;}</style>


Then quote it like this:
ff6d136ddc5fdfeffaf53ff6ee95f185
5408287d0cc4bf79b58e64855c714d1fe729f987a20b7718c76418a021c9b6b5test5db79b134e9f6b82c0b36e0489ee08edbed06894275b65c1ab86501b08a632eb
56e6ca07f1401ee4091f4334fd658f1dee7959cc8dd4be16ef633321c03dac32test25db79b134e9f6b82c0b36e0489ee08edbed06894275b65c1ab86501b08a632eb

Why didn’t the first LI successfully reference the style2 style? Or did I write the format wrong?

.style2{
background:#000000;
}

A period is missing.

.style2{
background:#000000;
}

A period is missing.

I fainted and made another stupid mistake. Thank you so much! Distribute points now! ! !

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