<body>
<div id="only" class="demo">123</div>
</body>
.demo { background-color: #ffeecc;}
#only { background-color: darkseagreen;}
.demo { background-color: #ffeecc;}
div { background-color: yellow;}
<body>
<div id="only" style="background-color: #fdc;">123</div>
</body>
#only { background-color: yellow;}
附加:属性选择器:(所有拥有这个属性的标签都会被定义;可以加上属性的值)
<div id="only" class="demo">123</div>
<div id="only1">598641</div>
[id] { background-color: violet;}
<div id="only" class="demo">123</div>
[id="only"] { background-color: violet;}
.demo { background-color: #f40;}
<div id="only" class="demo">123</div>
.demo { background-color: #f40;}
[id="only"] { background-color: violet;}
<body>
<div style="background-color: blueviolet;">2341345 </div>
</body>
div { background-color: turquoise !important;}
行间样式>id>class||属性选择器>标签>通配符