我想使用css創建菜單子菜單概念。它沒有按預期工作。預期輸出A-> A1 - > A1-1,對於其他元件也是如此。這是我到目前爲止所嘗試的。現在1級子菜單正在工作。只有CSS的菜單子菜單
我試着相同申請成爲this link
.list_item {
padding: 5px;
}
.blade {
height: 400px;
width: 200px;
border: 1px solid;
position: absolute;
top: 0;
background: #ddd;
z-index: 1000;
}
.blade .blade {
display: none;
left: 190px;
}
.list_item a:active + div.blade,
.list_item a:focus + div.blade,
.list_item a:hover {
display: block;
}
<div class="blade ng-scope">
<div class="list_item ng-scope">
<a class="item_a ng-binding" tabindex="0">A</a>
<div class="blade ng-scope">
<div class="list_item ng-scope">
<a class="item_a ng-binding" tabindex="0">A1</a>
<div class="blade ng-scope">
<div class="list_item ng-scope">
<a class="item_a ng-binding" tabindex="0">A1-1</a>
<div class="blade ng-scope">
<div class="list_item ng-scope">
<a class="item_a ng-binding" tabindex="0">A1-1 - 1</a>
</div>
<div class="list_item ng-scope">
<a class="item_a ng-binding" tabindex="0">A1-1 - 2</a>
</div>
<div class="list_item ng-scope">
<a class="item_a ng-binding" tabindex="0">A1-1 - 3</a>
</div>
<div class="list_item ng-scope">
<a class="item_a ng-binding" tabindex="0">A1-1 - 4</a>
</div>
</div>
</div>
</div>
</div>
<div class="list_item ng-scope">
<a class="item_a ng-binding" tabindex="0">A2</a>
<div class="blade ng-scope">
<div class="list_item ng-scope">
<a class="item_a ng-binding" tabindex="0">A2-1</a>
</div>
</div>
</div>
<div class="list_item ng-scope">
<a class="item_a ng-binding" tabindex="0">A3</a>
</div>
</div>
</div>
<div class="list_item ng-scope">
<a class="item_a ng-binding" tabindex="0">B</a>
<div class="blade ng-scope">
<div class="list_item ng-scope">
<a class="item_a ng-binding" tabindex="0">B1</a>
</div>
<div class="list_item ng-scope">
<a class="item_a ng-binding" tabindex="0">B2</a>
</div>
</div>
</div>
<div class="list_item ng-scope">
<a class="item_a ng-binding" tabindex="0">C</a>
</div>
</div>
何不你好ou使用ul> li? – guvenckardas
@guvenckardas就我而言,我無法使用ul。它應該是div,並且div – Shafeeque
http://jsfiddle.net/4hhgjaus/中可能還有其他元素,您也可以查看這一個 – guvenckardas