2011-07-06 23 views
0

我有以下的html代碼:懸停狀態不影響顯示性能

<div class="trial1"> 
He said all but the three newest reactors will be shut down by 2021, and the remainder a year later.Roettgen announced the agreement early on Monday morning after hour-long negotiations between the governing parties.Merkel in 2010 had pushed through to extend the lifespan of the country's 17 reactors with the last one scheduled to go offline in 2036, but she completely reversed her policy in the wake of Japan's nuclear disaster. She described the new move as a step that will make her country a pioneer in renewable energy. 

<h1>This is h1</h1> 

    <div class="trial2"> 
    this is something else what ever what ever 
    </div> 
</div> 

和我都有以下的CSS:

.trial1 
{ 
    position:relative; 
} 
.trial2 
{ 
    display:none; 
    position:absolute; 
    z-index:20; 
    top:1; 
    left:1; 
    width:30px; 
    height:30px; 
} 
.trial1:hover>.trial2 
{ 
    display:block; 
} 
.trial1:hover>h1 
{ 
    color:red; 
} 

每當trial1內容徘徊在我期待的內容要顯示的路徑2。但不知何故,這不會發生。在同一元素的懸停上更改h1顏色的類似過渡正在發揮作用?我究竟做錯了什麼?

+0

因爲這是一個「解決了因輸入錯誤」的問題,我建議將其刪除?我已經投了第一個刪除投票。 – halfer

回答

2

缺少.

.trial1:hover>.trial2 
+0

對不起,這是一個錯字...... – sasidhar

+0

沒有這個錯字,它的作品。 http://jsfiddle.net/Z6eZ3/ –

+0

+1 good catch @kingjiv –