2010-06-25 81 views
0

我遇到過這很多,它很煩人。有誰知道這一點:繼承古怪的CSS

#content h5 { 
color:red; 
} 

#next h5 { 
color:blue; 
} 

當標記看起來是這樣的:

<div id="content> 
    <h5>RED</h5> 

    <div id="next"> 
    <h5>BLUE</h5> 
    </div> 
</div> 

藍色H5實際上會出現紅,怎麼辦?

+0

有一個在你的標記,標識一個錯字=「內容」需要一個結束報價(假設這只是示例中的一個錯字)。在Chrome,Firefox和IE 8中,這個概念對我來說可行,網址爲http://jsfiddle.net/AWVdY/ 您使用的是哪種瀏覽器? – 2010-06-25 20:33:28

回答

2

我沒有問題。儘管如此,您在內容後仍然缺少引號。下面是我用

<html> 
<head> 
<style> 
#content h5 { 
color:red; 
} 

#next h5 { 
color:blue; 
} 
</style> 
</head> 
<body> 
<div id="content"> 
    <h5>RED</h5> 

    <div id="next"> 
    <h5>BLUE</h5> 
    </div> 
</div> 
</body> 
</html>