我正在尝试使用purecss库创建垂直下拉菜单但没有成功
purecss.io/menus/
我的css代码如下:
<div class="pure-menu custom-restricted-width">
<ul class="pure-menu-list">
<li class="pure-menu-item pure-menu-has-children">
<a href="#" id="menuLink1" class="pure-menu-link">T-Shirts</a>
<ul class="pure-menu-children">
<li class="pure-menu-item">
<a class="pure-menu-link" href="t-shirts-rundhals-tx-2-1,-1-2-.html">Rundhals</a>
</li>
<li class="pure-menu-item">
<a class="pure-menu-link" href="t-shirts-v-neck-tx-3-1,-1-3-.html">V-Neck</a>
</li>
<li class="pure-menu-item">
<a class="pure-menu-link" href="t-shirts-longsleeve-tx-4-1,-1-4-.html">Longsleeve</a>
</li>
<li class="pure-menu-item">
<a class="pure-menu-link" href="t-shirts-tanktop-tx-124-1,-1-124-.html">Tanktop</a>
</li>
</ul>
</li>
</ul>
</div>
即使我从他们的文档中复制粘贴示例代码也不能正常工作
答案 0 :(得分:2)
它正常工作只需为custom-restricted-width
添加css,因为您的pure-menu
div内容宽度为屏幕的100%,因此您无法显示下拉菜单。
.custom-restricted-width{
display:inline-block;
}