為什么下面的span class="first"沒有變成綠色呢
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>!important</title>
<style type="text/css">
p{color:red;}
p.first{color:green;}
</style>
</head>
<body>
? ? <h1>勇氣</h1>
? ? <p class="first">三年級(jí)時(shí),我還是一個(gè)<span>膽小如鼠</span>的小女孩,上課從來不敢回答老師提出的問題,生怕回答錯(cuò)了老師會(huì)批評(píng)我。就一直沒有這個(gè)勇氣來回答老師提出的問題。學(xué)校舉辦的活動(dòng)我也沒勇氣參加。</p>
? ? <p id="second">到了三年級(jí)下學(xué)期時(shí),我們班上了一節(jié)公開課,老師提出了一個(gè)很<span class="first">簡(jiǎn)單</span>的問題,班里很多同學(xué)都舉手了,甚至成績(jī)比我差很多的,也舉手了,還說著:"我來,我來。"我環(huán)顧了四周,就我沒有舉手。</p>
? ??
</body>
</html>
2020-07-02
中間加個(gè)空格就好了p .first則可以實(shí)現(xiàn)span的格式變化,且只能實(shí)現(xiàn)span的變化。如果是p.first中間沒有空格,表示p與.first的交集,故而只能顯示第一段的變化。
2020-04-15
因?yàn)閜.first{color:green}設(shè)置的是<p clsaa="first">這個(gè)段落的樣式,跟span class="first"沒有關(guān)系
設(shè)置span class="first",應(yīng)該是.first{}或者span{}這種選擇器
2020-03-05
2020-01-19
p.first{color:green;}
把p去掉
2019-12-11
p{color:red;} ? ? 權(quán)值為1
p.first{color:green;}? 權(quán)值為1+10
<p class="first">? 權(quán)值為1+10? 所以第一段內(nèi)容為綠色? (權(quán)值越大的優(yōu)先)
<p id="second"> 權(quán)值為1+100 所以第二段內(nèi)容為紅色? (權(quán)值越大的優(yōu)先)
2019-12-11
應(yīng)該設(shè)置span.first{color:green;}