斑斓猎人 2020-02-27 10:35 采纳率: 0%
浏览 461

CSS伪类选择器无效?小白求解?

html:

<!DOCTYPE html>
<html lang="zh_cn">
<head>
    <title>Css3.0_Test01</title>
    <meta charset="utf-8">
    <link rel="stylesheet" type="text/css" href="主页.css">
</head>
<body>
    <nav class="header">
        <img src="资源\logo.png">
        <div class="drop">
    <button  type="button"><a href="">主页</a></button>
</div>
<div class="drop2">
    <button type="button"><a href="">分区浏览</a></button></div>
    <div class="drop-menu">
        <a href="">1</a>
        <a href="">1</a>
        <a href="">1</a>
    </div>
</nav>
</body>
</html>

CSS:

@charset "utf-8";
*{padding: 0;margin: 0;}   /*rest*/
.header{
    height: 90px;
    width: 100%;
    background-color: #33a3dc;
    position: relative;
}
.header img{
    width: 90px;
    height: 90px;
}
.drop button{
    position: absolute;
    top: 60px;
    left: 180px;
    background-color:#33a3dc;
    border: 2px;
}
.drop button a{
    text-decoration: none;
    color: #fff;
    font-size: 20px;
    font-weight: bold;
}
.drop button:hover , .drop2 button:hover{
    background-color: #78cdd1;
}
.drop2 button{
    position: absolute;
    top: 60px;
    left: 360px;
    background-color:#33a3dc;
    border: 2px;
}
.drop2 button a{
    text-decoration: none;
    color: #fff;
    font-size: 20px;
    font-weight: bold;
}
*{
    padding: 0;margin: 0;
}   /*rest*/
.drop-menu{       /* 问题代码段*/
    display: none;
}
}       
.drop2 button:hover .drop-menu{
    display: block;
} /* 问题代码段*/

我想单鼠标悬停在按钮上时实现下拉菜单框的效果,但用hover却没有实现预期效果,class赋值没问题,也没有和link、active、visited一起使用,是不是我在使用CSS伪类选择器时还有别的固定要求啊??请诸位大虾指导指导!

  • 写回答

2条回答 默认 最新

  • zqbnqsdsmd 2020-02-27 11:05
    关注
    评论

报告相同问题?

悬赏问题

  • ¥15 怎么获取下面的: glove_word2id.json和 glove_numpy.npy 这两个文件
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 oracle集群安装出bug