<style> .red_bg {background: # f00; } .red_text {color: # f00; } .red_bg.red_text {color: #fff; } / * this rule will apply when both previous classes are indicated simultaneously * / </ style> <div class = "red_bg"> this is text on red background </ div> <div class = "red_text"> this is red text </ div> <div class = "red_bg red_text"> on a red background, the text became white </ div>
<style type = "text / css"> .red_bg.red_text.bordered {...} </ style>
<style type = "text / css"> # menu.red_text {...} / * usually class = "red_text" does one thing, and for #menu the same class can add another description * / </ style>
<style type = "text / css"> h1 {background: # 000; color: #fff; } .notice {color: # 00f; } h1.notice {color: # ee8; } </ style> <p class = "notice"> The text in the block with class = "notice" is blue. </ p> <h1> The first level heading is white on a black background. </ h1> <h1 class = "notice"> The first level heading with the class = "notice" becomes light, because blue on black cannot be read </ h1>
Source: https://habr.com/ru/post/40560/
All Articles