9-2·100 css下拉菜单
作者:互联网
<!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>下拉菜单</title> <style> .hover { position: relative; display: inline-block; } .hover2 { display: none; position: absolute; background-color: #f9f9f9; min-width: 160px; box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2); padding: 12px 16px; } .hover:hover .hover2 { display: block; } /* 加入边框即可。不需要再弄表格 */ .bor { border: 1px solid red; } </style> </head> <body> <h2>鼠标移动后出现下拉菜单</h2> <p>将鼠标移动到指定元素上就能看到下拉菜单</p> <p>Move the mouse over the specified element to see the drop-down menu</p> <div class="hover"> <span class="bor">鼠标移动到这里</span> <div class="hover2"> <p>自强不息</p> <P>无敌天下</P> <p>替天行道</p> </div> </div> <!-- 无序列表 <ul> <li> <span>鼠标移动这里2</span> </li> </ul> --> <table> </table> </body> </html>
效果
标签:hover,鼠标,下拉菜单,position,100,移动,display,css 来源: https://www.cnblogs.com/zhuiqiuzhuoyueyouminxing/p/15874300.html