1. font-size :0;不能随便写,特别是不能写在最高父级的div里;
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <link href="//netdna.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css" rel="stylesheet"> <!-- 新 Bootstrap 核心 CSS 文件 --> <link href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"> <!-- jQuery文件。务必在bootstrap.min.js 之前引入 --> <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script> <!-- 最新的 Bootstrap 核心 JavaScript 文件 --> <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script> <style> body{ margin:0; } .c2{ 80%; height:50px; margin:50px auto 0; /*font-size: 0;*/ } .ccz01{ display: none; position: absolute; background-color: #b0b0b0; min- 160px; box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); } .dropdown:hover .ccz01{ display: block; } .desc { padding: 15px; text-align: center; } </style> </head> <body> <div class="c2"> <div class="dropdown"> <a href="#" class="dropbtn">Django基础</a> <div class="ccz01"> <img src="../image01/01.png" alt=""> <div class="desc">学的不仅是技术,更是梦想!</div> </div> </div> </div> </body> </html>
(2)