<!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!mportant;}p .first{color:green;}/*p和first間有空格*/</style></head><body>? ? <h1>勇氣</h1>? ? <p class="first">三年級時,我還是一個<span>膽小如鼠</span>的小女孩,上課從來不敢回答老師提出的問題,生怕回答錯了老師會批評我。就一直沒有這個勇氣來回答老師提出的問題。學校舉辦的活動我也沒勇氣參加。</p>? ? <p id="second">到了三年級下學期時,我們班上了一節(jié)公開課,老師提出了一個很<span class="first">簡單</span>的問題,班里很多同學都舉手了,甚至成績比我差很多的,也舉手了,還說著:"我來,我來。"我環(huán)顧了四周,就我沒有舉手。</p>? ??</body></html>這是什么原因?
1 回答
剛毅87
TA貢獻345條經驗 獲得超309個贊
p.first (不加空格)表示 class 名為 first 的 p 標簽,所以 span"簡單"不變色;
而p .first(加空格 )表示p 標簽以下 class 名為 first 的標簽,所以 span 就變色了;
p{color:red!;}這個你沒寫完全,
p {
color: red!important;
}
添加回答
舉報
0/150
提交
取消
