position: relative;position: absolute; 使用定位加显示隐藏就可实现了

解决方案 »

  1.   

    <html>
    <head>
    <title>测试</title>
    <style>
    .dis{
    width: 120px;
    line-height: 20px;
    height: 60px;
    background-color: blue;
    border-bottom-width: 1px;
    display:none;
    }
    </style>
    <script>
    function show(d){
    document.getElementById(d).style.display='block'; //显示层
    }
    function hide(d){
    document.getElementById(d).style.display='none'; //隐藏层
    }
    </script>
    </head>
    <body><span href='#' onmousemove="show('dis')" onmouseout="hide('dis')">鼠标放上显示层</span>
    <div id="dis" class="dis">层内容</div>
    </body>
    </htmle>