2013-09-29 34 views
-1

這裏我司#about:你能看到的錯誤在這個HTML/CSS代碼?

<div id="about" onMouseOver="document.getElementById('screen').style.top=60" onMouseOut="document.getElementById('screen').style.top=0"></div> 

我想達到改變鼠標時獲得超過這個時間one.First它的工作完美,但現在並不想move.For例如彼此的分工協調,當我background它的工作原理更換top

下面是我司要影響:

<div id="screen"> 
    <a id="msg"></a> 
</div> 

和風格的它:

#screen 
    { 
     height:25px; 
     width:500px; 
     position:absolute; 
     top:0;left:0;right:0;bottom:0; 
     margin:auto; 
     border-style:solid; 
     border-radius:10px; 
     text-align:center; 
     font-style:italic; 
     opacity:0; 
     background-image:url("http://www.psdgraphics.com/file/light-wooden-background.jpg"); 
     transition:opacity 1s, top 0.4s; 
    } 

謝謝。

+2

你需要指定單位(我假設像素如此'「60px」') – JJJ

回答

3

要設置top的號碼。 CSS長度(0除外)必須有單位。

.style.top = '60px' 

(怪癖模式,瀏覽器會忽略CSS規範忽略與無效性規則的要求,將承擔像素,這可能是爲什麼它的工作是第一次。)

相關問題