选择下拉菜单显示和隐藏的实现
<html> <head> <meta charset="UTF-8"> <title></title> <style type="text/css"> .menu:hover .menucontent{ display: block; } .menucontent{ width: 120px; display: none; text-align: center; border: 1px solid #ddd; } .menu .btn{ display: block; width: 50px; height: 20px; text-align: center; font-size: 14px; background: red; color: #fff; } </style> </head> <body> <div class="menu"> <span class="btn">菜单</span> <div class="menucontent"> <p>hello</p> <p>world</p> <p>helloWorld</p> </div> </div> </body> </html>