白白是baibai 2022-04-21 10:26 采纳率: 50%
浏览 48
已结题

nav中给a设置:hover不起作用,还有button背景图片显示不出来


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="style.css">
</head>
<body>
<div class="header w">
    <div class="logo"><img src="images/logo.png" alt=""></div>
    <div class="nav">
        <ul>
            <li><a href="#">首页</a></li>
            <li><a href="#">课程</a></li>
            <li><a href="#">职业规划</a></li>
        </ul>
    </div>
    <div class="search">
        <input type="text" placeholder="请输入关键词">
            <button></button> 
     </div>
        <div class="user">
            <img src="/images/user.png" alt="">
            bkppjhhh
        </div>
    </div>
</div>
</body>
</html>
*{
    margin: 0;
    padding: 0;
}
.w{
    width: 1200px;
    margin: 0;
}
a{
   
    text-decoration: none;
}

li{
    list-style: none;
}
body{
    background-color: #f3f5f7;
}
.header{
    float: left;
    margin: 30px auto;
    width: 1200px;
    height: 42px;
   
}
.logo{
    float: left;
    width: 200px;
    height: 50px;
}
.nav{
    float: left;
    margin-left: 50px;
    height: 42px;
  
}
.nav ul li{
    float: left;
    margin-left: 15px;
    line-height: 42px;
}
.nva ul li a{
    display: block;
    height: 42px;
    padding: 0 10px;
    line-height: 42px;
    font-size: 18px;
    color: #050505;
}
.nva ul li a:hover{
    border-bottom: 2px solid #00a4ff;
    color: #00a4ff;
}

.search{
    float: left;
    margin-left: 60px;
    width: 415px;
    height: 42px;

}
.search input{
    float: left;
    padding-left: 15px;
    border: 1px solid #00a4ff;
    border-right: none;
    width: 348px;
    height: 42px;
    font-size: 14px;
    color: #bfbfbf;
}
.search button{
    display: block;
    float: left;
    border: 0px;
    width: 48px;
    height: 42px;
    background-repeat: no-repeat;
    background-color: transparent;
    background-image: url(/images/search.png);
}
.user{
    float: left;
    height: 42px;
}
.img{
    float: left;
    width: 40px;
    height: 42px;
}



  • 写回答

3条回答 默认 最新

  • 雾里桃花 2022-04-21 10:41
    关注

    1.a标签hover不显示的问题 class样式表中 class名写错了 应该是 .nav 你写成了 .nva
    2.button不显示背景图片的问题:在css样式中添加一行样式 background-size: 100% 100%;

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

问题事件

  • 系统已结题 4月29日
  • 已采纳回答 4月21日
  • 创建了问题 4月21日

悬赏问题

  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效