<html>
<head>
<title>下拉列表</title>
<style>
.dropdown{
position:relative;
display:inline-block;
}
.dropdown-content{
display:none;
background-color:grey;
position:absolute;
border:1px solid red;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
}
.dropdown:hover .dropdown-content{
display:inline;
}
.dropdown-content a{
display:block;
text-align:center;}
.dropdown-content:hover a{text-decoration:none;background-color:yellow;}
.dropdown-content a:hover{
background-color:pink;
color:green;
}
a:hover{display:block;}
</style>
</head>
<body>
<div class="dropdown">
<div style="border:4px solid purple;">浏览器</div>
<div class="dropdown-content" >
<a href="http://www.baidu.com">百度</a>
<a href="http://www.google.com">谷歌</a>
<a href="http://www.hao123.com">hao123</a>
</div>
</div>
</body>
</html>
结果:
使用display:inline为何不能使下拉列表显示在右边?大佬们,求助。