index.html
<!DOCTYPE html>
<html lang="en"><head><!--系统内置 start--><script type="text/javascript"></script><!--系统内置 end--><meta charset="UTF-8"><title>练习</title><!-- 不要忘记引入index.css --><link rel="stylesheet" href="index.css">
</head><body><div class="search"><input placeholder="红米k20"><div class="right"><div class="giao"></div></div></div><div class="box"><ul><li>小米9</li><li>Redmi K20 pro</li><li>Redmi K20</li><li>Redmi note 7 Pro</li><li>Redmi note 7</li><li>小米电视4c</li><li>电视32英寸</li><li>笔记本Pro</li><li>小爱音箱</li><li>净水器</li></ul></div>
</body></html>
index.css
body {margin: 0;
}
.search{width: 254px;
height: 42px;
background: #FFFFFF;
border: 1px solid #E0E0E0;
box-sizing:border-box;
}
.search>input{font-size: 12px;
line-height: 17px;
color: #AEAEAE;
border:none;
margin-top:13px;
margin-left:20px;
}
.right{float:right;
width: 42px;
height: 42px;
background: #FFFFFF;
border: 1px solid #E0E0E0;
margin-right:-1px;
margin-top:-1px;
box-sizing:border-box;
}
.giao{width: 16px;
height: 16px;
margin-top:13px;
margin-left:13px;
background:url(./images/search-normal.png) no-repeat ;}
.giao:hover{background:url(./images/search-hover.png);}
.box{width: 213px;
height: 282px;
background: #FFFFFF;
border: 1px solid #FD6821;
box-sizing: border-box;
display:none;
}
ul{display:none;
}
.box:hover+ul{display:block;
}
.search:hover{border: 1px solid #FD6821;
}
.right:hover{border: 1px solid #FD6821;
}
运行结果