用CSS樣式實現顯示隱藏層

來源:互聯網
上載者:User

  此方法不用JavaScript,代碼少、簡單,顯示的層自動在連結處
  以下代碼加入頁面中,滑鼠懸浮於連結“1234567890”上時,層內容“11111111”顯示,滑鼠離開時層恢複隱藏狀態。

 代碼如下 複製代碼
<a href="####" style="color:blue" onMouseOver="document.all.Layer1.style.visibility=''" onMouseOut="document.all.Layer1.style.visibility='hidden'">
1234567890</a>
<div id="Layer1" style="position:absolute; width:300px; height:100px; z-index:1; background-color: #CCFFFF; layer-background-color: #CCFFFF; border: 1px none #000000; visibility: hidden">11111111</div>
相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.