我正在基于_underscores
开发WordPress主题。默认情况下,所有子菜单项都显示在主父菜单项的下方和左侧。我的菜单(实际上只是几个用于登录和搜索的图标)一直显示在右侧。因此,我希望子菜单项显示在主菜单项的右侧,而不是显示在左侧。我一直在努力使它工作,但还没有运气。
有问题的页面是:http://vps46331.inmotionhosting.com/~hellod8/
/** Here's my CSS **/
.site-users ul ul {
background: #3B66CA;
float: right;
position: absolute;
top: 100%;
right: -999em;
z-index: 99999;
}
.site-users ul ul li:hover > ul,
.site-users ul ul li.focus > ul {
right: 0;
}
.site-users ul li:hover > ul,
.site-users ul li.focus > ul {
right: auto;
}
<!-- Here's my HTML -->
<div class="site-users">
<nav>
<ul>
<li>
<a href="#ultimem" title="Account Info"><i class="fas fa-user"></i></a>
<ul class="sub-menu ultimem">
<li>This is Food</li>
</ul>
</li>
<li>
<a href="#searchbox" title="Site Search"><i class="fas fa-search"></i></a>
<ul class="sub-menu ultisearch">
<li>
<form role="search" method="get" class="search-form" action="http://vps46331.inmotionhosting.com/~hellod8/">
<label>
<span class="screen-reader-text">Search for:</span>
<input type="search" class="search-field" placeholder="Search …" value="" name="s" />
</label>
<input type="submit" class="search-submit" value="Search" />
</form>
</li>
</ul>
</li>
</ul>
</nav>
</div>