在上一节中,咱们处置了 class 值中搜罗一个词的情况。在 HTML 中,一个 class 值中或许搜聚一个词列表,各个词之间用空格分隔。譬喻,如果指望将一个特定的元素同时标志为重要(important)与告诫(warning),即可以写作:
<p class="important warning"> This paragraph is a very important warning. </p>
这两个词的法度无关必要,写成 warning important 也可以。
咱们假设 class 为 important 的一切元素凡是粗体,而 class 为 warning 的一切元素为斜体,class 中同时搜聚 important 与 warning 的悉数元素还有一个银色的后援 。就能写作:
.important {font-weight:bold;} .warning {font-style:italic;} .important.warning {bac千克round:silver;}
如需转载,请注明文章出处和来源网址:http://www.divcss5.com/css-tool/t51749.shtml