首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >多级下拉列表W3.CSS

多级下拉列表W3.CSS
EN

Stack Overflow用户
提问于 2018-07-08 19:12:29
回答 1查看 1.5K关注 0票数 5

我想知道w3.css是否支持多级下拉列表?

代码语言:javascript
复制
<div class="w3-top">
            <div class="w3-bar w3-black w3-card">    
                <a class="w3-bar-item w3-button w3-padding-large w3-hide-medium w3-hide-large w3-right" href="javascript:void(0)" onclick="toggleScreensizeNav()" title="Toggle Navigation Menu"><i class="fa fa-bars"></i></a>
                <a href="#" class="w3-bar-item"><img class="w3-center" src="/img/logo.png" alt="LOGO" height="30"></a>
                <a href="#" class="w3-bar-item w3-button w3-padding-large w3-hover-cyan">HOME</a>         
                <div class="w3-dropdown-hover w3-hide-small">
                    <button class="w3-padding-large w3-button w3-hover-cyan ">DROPDOWN<i class="fa fa-caret-down"></i></button>     
                    <div class="w3-dropdown-content w3-bar-block w3-card-2 w3-animate-opacity">
                        <a href="#" class="w3-bar-item w3-button">First Dropdown Link</a> 
                        <a href="#" class="w3-bar-item w3-button w3-hover-cyan">Second Dropdown Link</a>   
                        <a href="#" class="w3-bar-item w3-button w3-hover-cyan">This should open another Dropdown</a>
                    </div>
                </div>     
            </div>
        </div>

结果:

这就是我目前所拥有的。如果我尝试复制并粘贴下拉块到第三个链接,这应该会打开另一个下拉列表,它总是显示出来,而不仅仅是当我开始悬停链接的时候。我也想如果新的下拉菜单可以向右打开。

这是我尝试过的:

代码语言:javascript
复制
<div class="w3-top">
            <div class="w3-bar w3-black w3-card">    
                <a class="w3-bar-item w3-button w3-padding-large w3-hide-medium w3-hide-large w3-right" href="javascript:void(0)" onclick="toggleScreensizeNav()" title="Toggle Navigation Menu"><i class="fa fa-bars"></i></a>
                <a href="#" class="w3-bar-item"><img class="w3-center" src="/img/logo.png" alt="LOGO" height="30"></a>
                <a href="#" class="w3-bar-item w3-button w3-padding-large w3-hover-cyan">HOME</a>         
                <div class="w3-dropdown-hover w3-hide-small">
                    <button class="w3-padding-large w3-button w3-hover-cyan ">DROPDOWN<i class="fa fa-caret-down"></i></button>     
                    <div class="w3-dropdown-content w3-bar-block w3-card-2 w3-animate-opacity">
                        <a href="#" class="w3-bar-item w3-button">First Dropdown Link</a> 
                        <a href="#" class="w3-bar-item w3-button w3-hover-cyan">Second Dropdown Link</a>   
                        <div class="w3-dropdown-hover w3-hide-small">
                            <button class="w3-padding-large w3-button w3-hover-cyan ">This should open another Dropdown<i class="fa fa-caret-right"></i></button>     
                            <div class="w3-dropdown-content w3-bar-block w3-card-2 w3-animate-opacity">
                                <a href="#" class="w3-bar-item w3-button">1st Link</a> 
                                <a href="#" class="w3-bar-item w3-button w3-hover-cyan">2nd Link</a>   
                            </div>
                        </div>     
                    </div>
                </div>     
            </div>
        </div>

结果:

我现在正在使用w3.css。到目前为止,它解决了我所需要的一切。有什么想法,我可以添加到css的第二个下拉将工作,而不是已经显示时,悬停第一个下拉?

EN

回答 1

Stack Overflow用户

发布于 2018-12-13 09:44:41

这不是一个多级解决方案(只针对两个嵌套的下拉列表):

.w3-dropdown-hover:hover .w3-dropdown-content .w3-dropdown-content {display:none} .w3-dropdown-hover:hover .w3-dropdown-hover:hover .w3-dropdown-content {display:inline;right:100%}

第一行隐藏内部下拉列表,第二行显示悬停状态。

如果你想把第二行的内容移到左边,去掉"rigth:100%“。

干杯!

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51231395

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档