我试图并排而不是从上到下显示菜单的下拉部分。我必须 display: none 使菜单工作,而 float: left 没有这样做。我没有想法,不知道还有什么需要显示的:没有人可以隐藏列表,直到它需要显示。我抛出了 float: 几乎到处都是。CSS:
ul {
margin: 0;
padding: 0;
list-style-type: none;
min-width: 200px;
float: left;
display: inline;
}
ul#navigation {
float: left;
}
ul#navigation li {
float: left;
border: 1px black solid;
min-width: 200px;
}
ul.sub_navigation {
position:absolute;
float: left;
display: inline;
display: none;
}
ul.sub_navigation li {
clear: both;
float: left;
display: inline;
}
a,a:active,a:visited {
display: block;
padding: 10px;
}
的HTML:
<div id="menu">
<ul id="navigation">
<li class="dropdown"><a href="javascript:ajaxpage('home.php', 'body');">Home</a></li>
<li class="dropdown"><a href="javascript:ajaxpage('projects.php', 'body');">Projects</a>
<ul class="sub_navigation" style="float: left;">
<!-- pull projects with P H P -->
<li><a href="javascript:ajaxpage('openproj.php?id=<? echo $row['id']; ?>', 'body');"><? echo $row['name']; ?></a></li>
<li><a href="javascript:ajaxpage('createproj.php', 'body');">Add a project</a></li>
<?php
}
?>
</ul>
</li>
<li class="dropdown"><a href="javascript:ajaxpage('pubfiles.php', 'body');">Public Files</a></li>
<li class="dropdown"><a href="javascript:ajaxpage('users.php', 'body');">Users</a></li>
<li class="dropdown"><a href="javascript:ajaxpage('settings.php', 'body');">Settings</a></li>
<!-- only pull if admin and logged in per P H P session-->
<li class="dropdown"><a href="javascript:ajaxpage('admin.php', 'body');">Admin</a></li>
</ul>
</div>