html - 求解关于伪类和visibility的问题
迷茫
迷茫 2017-04-17 11:09:11
0
1
601

想把鼠标悬停在“用户”上时表格会显现出来,可是为什么以下代码不能实现?到底哪里错了好烦躁呀!

html<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <style>
     table{
         visibility: hidden;
     }
      a:hover table{
        visibility: visible;
     }
    </style>
</head>
<body>


<p>

    <a href="">用户</a>
    <table>
        <tr>
            <td>
                <a href="">好友</a>
            </td>
        </tr>
        <tr>
            <td>
                <a href="">关注</a>
            </td></tr>
        <tr>
            <td>
                <a href="">设置</a>
            </td>
        </tr>
        <tr>
            <td>
                <a href="">消息</a>
            </td>
        </tr>
    </table>
 
  </p>


</body>
</html>
迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

reply all(1)
左手右手慢动作

The css selector is used incorrectly

cssa:hover table{
   visibility: visible;
}

represents a ancestor element that is a a element, and the a element whose status is hover is visible. table For your html, the
element is the atable sibling element of the element and should be:

cssa:hover + table{
   visibility: visible;
}
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template