1、css選擇器
*{margin:0;padding:0}
div{color:red}
<div>....</div> <!-- 對應以上兩條樣式 -->
<div class="box">....</div> <!-- 對應以上兩條樣式 -->
#box{color:red}
<div id="box">....</div> <!-- 對應以上一條樣式,其它元素不允許應用此樣式 -->
.red{color:red}
.big{font-size:20px}
.mt10{margin-top:10px}
<div class="red">....</div>
<h1 class="red big mt10">....</h1>
<p class="red mt10">....</p>
.box span{color:red}
.box .red{color:pink}
.red{color:red}
<div class="box">
<span>....</span>
<a href="#" class="red">....</a>
</div>
<h3 class="red">....</h3>
.box1,.box2,.box3{width:100px;height:100px}
.box1{background:red}
.box2{background:pink}
.box2{background:gold}
<div class="box1">....</div>
<div class="box2">....</div>
<div class="box3">....</div>
.box1:hover{color:red}
.box2:before{content:'行首文字';}
.box3:after{content:'行尾文字';}
<div class="box1">....</div>
<div class="box2">....</div>
<div class="box3">....</div>
文本標簽
- em標簽用于表示一段內容中的著重點。
- strong標簽用于表示一個內容的重要性。
- i標簽會使文字變成斜體。
- b標簽會使文字變成粗體。
- 瀏覽器在顯示small標簽時會顯示一個比父 元素小的字號。
- 使用cite標簽可以指明對某內容的引用或參 考。
- blockquote和q表示標記引用的文本。
- blockquote用于長引用,q用于短引用。
- sup和sub用于定義上標和下標。
- ins表示插入的內容,顯示時通常會加上下 劃線。
- del表示刪除的內容,顯示時通常會加上刪 除線。